Fighting with Perl

I expected learning Perl to be challenging, but I never expected to have to work so hard to get a simple “Hello World” script running.

Perl’s a server-side programming language, normally found on Unix servers, which is extremely useful for writing all sorts of programs, especially those involving text manipulation. I know some Perl, just enough to read a program, understand its logic and to modify it to do what I want.

I’ve wanted to delve into it more deeply for years, but have never had the time. Now, thanks to the convergence of a several happy facts I’m making the time.

What are those happy facts? Well, first there’s arrival of my Power Mac at home, which is allowing me to do all sorts of industrial-strength projects in my home office. There’s the desire to automate certain tasks on my new Mac, like uploading bookmarks from Safari and playlists from iTunes to Nuketown. And speaking of Nuketown, I want to automate some server-side stuff, like creating a daily RSS feed for the site.

Unfortunately, Perl isn’t cooperating. I have access to about a half-dozen machines capable of running Perl, and I haven’t been able to get my simple “Hello World” program to work on any of them. Nuketown’s cgi-bin (that cryptic area that stores computer programs on Web servers)? Sure it’ll run the stuff that’s already there, but when I upload my program — always remembering to change mode to make it executable — it doesn’t work. By a strange twist of fate, the cgi-bin at my day job will let me upload scripts, but won’t let me change the permissions on them (no doubt the result of one of our recent server upgrades … it happens). And while I was able to get server side includes and PHP (another scripting language) running on the Apache Web Server on my Power Mac at work, it refuses to run my Perl scripts, saying that my file isn’t closed properly (or some such error message that I gleaned from my server log).


Still, I haven’t given up hope. I’m now going to attempt to install Perl 5.8.0 on my Power Mac to see if I can get it running (at the very least, this will upgrade Perl to its latest version). Fortunately, this isn’t something that I need to puzzle through myself — the nice folks at the O’Reilly MacDevCenter have written a tutorial on how to do all this.

In theory, this should resolve the last of my issues on the Power Mac, and set the stage for me to finally blow through my Learning Perl (Amazon) book (an excellent tutorial resource, which unsurprisingly does require a working version of Perl to use properly). In practice of course, I could end up spending my day screaming at my Mac … but hey, either way I learn something.