ActiveBlog

Packaging Perl for Windows with PDK - Patriot NG
by Troy Topnik

Troy Topnik, November 24, 2011
Patriot NG - Perl Dev Kit

We love fan mail, especially when it's on Twitter where everyone can see it. Yago Jesus, a PDK and Komodo user, let us know how much he enjoyed using our software, and pointed out some software he's created for intrusion detection on Windows.

Since we haven't made much noise lately about the Perl Dev Kit and all its handy tools, let's have a look at Patriot NG and how PerlApp can be used to deploy seriously useful Windows software.

But first, some back-story.

Perl on Windows

ActiveState was founded on the premise that dynamic languages like Perl are useful tools no matter what platform you're running on. Porting Perl to Windows was one of our first steps towards delivering "Programming for the People", and indeed ActivePerl has introduced Perl to millions of Windows users over the years. These users can take advantage of the wealth of freely available modules from CPAN and build their own applications.

However, when it comes time to deliver these applications to end users, they will need an interpreter installed on their system to run your code. It's a lot to ask of someone to install ActivePerl when they only want to run your 20 line script, and won't be doing any programming themselves. This is less of a problem on Linux and UNIX-based systems because Perl is often installed by default, but on Windows it's an annoying extra step.

The PDK deployment tools solve this problem by packaging Perl programs as stand-alone executables, Windows services, ActiveX components or .NET assemblies. Jago used the PDK to package a real-time system monitoring utility built in Perl.

Patriot NG

Patriot NG is an intrusion detection system for Windows which monitors registry key changes, new service installation, file changes and a number of other system events.

I asked Yago a few questions about his software:

Why did you chose Perl for this application?
Well, probably many people think that Perl is a language for parsing files or web-CGIs only, but Perl is a great language for writing Windows applications because it has many Windows-specific libraries for Windows internals. I recommend looking at the Win32-* modules in CPAN. Pretty impressive.
Which CPAN modules were most useful to you?

I'm using a lot of the Win32 modules, for example:

Which of the PDK tools did you use to package Patriot NG?
I'm using PerlApp and PerlTray.
I noticed the software installs a few different executables. How do they work together?

The architecture is simple. A main .exe called 'patriot.exe' runs in the tray. It starts and stops, updates NIDS rules and launches the configurator. Also there are three programs, one for general activities, one for network and another for file monitoring. Moreover, there are two graphic programs, one for configurate settings and other for draw and process alerts.

I have come to Windows from Unix, so I made Patriot modular, the Unix way.

Try it out

The Perl Dev Kit has a 21 day trial license, so you can try out these deployment tools on your own code, or with the some of the sample Perl programs. If you find it useful, now is an excellent time to buy. Our Thanksgiving Weekend Sale is running through Nov. 28. You can save $50 on single licenses (or $250 off 5-packs) of Perl Dev Kit, Tcl Dev Kit, or Komodo IDE.

Subscribe to ActiveState Blogs by Email

Share this post:

Category: perl
About the Author: RSS

Troy Topnik is ActiveState's technical writer. After joining ActiveState in 2001 as a "Customer Relationship Representative" (AKA Tech Support), Troy went on to lead the PureMessage Enterprise Support team before moving on to a technical writing role in 2004. His talent for describing software for new users stems from his difficulty understanding things that developers find obvious. He has a Bachelor of Music from the University of Victoria.