[ Tech stuff | NT ]

Perl on Windows NT

This page is grossly outdated. Like, circa 2001 or so, if that late. Please don't contact me for support on the stuff here. I haven't touched Windows NT for almost ten years.

In its native land, Unix, Perl is an enormously useful thing. But when you get to the desert wastes of NT, where there really is no viable scripting language, Perl is a godsend. Your alternatives are DOS batch language (ick), Visual Basic (VB has its place, but I'm not supposed to use those words) or C (fly. sledge hammer.).

What follows are some of my ramblings. Hopefully, the weary traveller will find something of use here.

Where do I get it?

Long, long ago (actually just a year or so, but it seems longer) there were two versions of Perl for Windows. Well, really three. There was the version from Hip Communications, which later became ActiveWare, which is now called ActiveState. Then there was Gurusamy Sarathay's binary distribution, which was available on CPAN. And, to those that were truly daring, you could get the source code from CPAN and try to build it yourself. The last option there never actually worked for me, because I never could fathom the intricasies of Microsoft Visual C++ enough to get Perl to compile.

These days, there's really just ActiveState. Gurusamy works there now. You can download the latest version of Perl from ActiveState, and have it running inside of 5 minutes. It's very nice. And while there used to be a complaint that the NT version was always several releases behind the Unix version, now it is always all the way caught up with the Unix version, since the 5.005 code will build on NT and Unix.

Why would I want it?

Because NT has no scripting language that ships with it. That's the quick and easy answer. When you want to do something simple - no matter how simple - you have to click buttons, select menu items, and close dialogs. This is all very nice, if you like that sort of thing, but makes automation a nightmare. If you want to restart your web server, for example, you would need to click, click, click, click, about 10 times to get it done. Admittedly, that's not too much of a hardship, but it is very difficult to do automatically.

Enter Perl. If you can write some little bits of code that do this task for you, then it becomes easier to schedule it to happen automatically in your absence. OK, admittedly, restarting an NT service is not the best example, because it can be done with a DOS batch file (net stop Apache, net start Apache). But once things get more complicated than that (I want to remove all files older than a week, and I want to do this every morning at 2) batch swiftly becomes way too cumbersome for that.

And, once you get the hang of Perl, you realise that it is able to do so much more. You can use it to fetch a web page for you. You can have it send you email when you're running out of disk space. You can have it purge old database entries. And each of those examples can be done in 20 lines of code or less, while the corresponding C program would be a major undertaking.