Article
Which Server-Side Language Is Right For You?
CGI/Perl
Perl has been around longer than the World Wide Web itself. Version 1 was released on December 18th 1987, a full decade before the other languages covered in this article were even conceived! If you're new to this stuff, you're probably wondering how a server-side Web development language could have existed before the Web itself. You see, Perl was not created as a Web development language. Perl is, in fact, a multipurpose scripting language that was designed to handle tasks that involve a lot of text manipulation. Perl is very good at juggling pieces of text from various sources and combining them to form complete documents, which is exactly what is involved in server-side Web development.
In the decade and a half since its creation, Perl has been expanded by means of modules, pieces of somtimes-complex functionality that can be plugged into the language to adapt it to various specialized purposes. One such purpose is the creation of dynamic Web content via the Common Gateway Interface (CGI) supported by the vast majority of Web servers. CGI is a standard means by which the Web server software can hand a browser's request for a Web page off to any program. Truth be told, CGI programs can be (and have been, on occasion) written in C/C++ if necessary. With its convenient handling of text, however, Perl has always been better suited to the job, and now that Perl comes with the CGI.pm module built in, most of the nitty gritty details of handling things like HTML form submissions are handled for you. As a final boon, the Comprehensive Perl Archive Network (CPAN) was founded to provide a centralized source for add-in modules, sample scripts, and in some cases fully developed Web applications.
Today, versions of Perl are available for free on all major operating systems (from mainstream Windows to the most obscure Unix variant), and if you want to make it do something complicated, chances are someone has already written a module to make your job easier. The only downside to this language is that, since it wasn't purpose-built for Web development, it hasn't been optimized either for speed, scalability, or ease of use in a Web server setting. There are much easier languages out there to learn that can do just as much in the Web development arena, but Perl will also let you do a lot more than just Web development if you need to.
Advantages:
- A mature language with over a decade of history, you're less likely to run into bugs in Perl than in any other server-side language.
- It's FREE, though a good book to show you the ropes may set you back a little.
- Most good Web hosts support Perl, so you probably won't have to pay extra for hosting.
- A vast network of dedicated Perl developers all over the world are at your disposal. Not only will they answer your questions on countless Perl discussion groups and mailing lists, but the CPAN archive (among others) will give you plenty of examples to work from.
Drawbacks:
- Although some options exist to improve the situation, Perl doesn't scale especially well on busy servers. If you're looking to create a Web application that can field a lot of hits in a short space of time, you may want to look elsewhere.
- Perl is notorious for having five different ways of doing even the simplest thing, which can make learning from the work of others difficult if they didn't use the same method you're used to seeing. Additionally, Perl developers are notorious for finding the shortest way to write any given program, so you may be surprised to look at a sample script only to find that a complete ecommerce shopping cart script has been written in three lines of code, most of which is squiggles and backslashes.
- Perl is optimized for the Unix platform on which it was created, so if you expect to work on a Windows server, you likely have better choices performance-wise.
- Perl is Open Source software, which means there is no formal support for it. Despite the huge support community available to you, if something goes wrong, the only person you can really count on is yourself.
Target Developer:
Most Web developers who still work with Perl today tend to be Unix administrators and users who also put Perl to work in other areas of their system. For people like these, Perl is a comforting 'go anywhere, do anything' tool that can always be relied upon. If you're an inexperienced developer faced with the task of maintaining a site that was originally written in Perl, then grab a couple of good books and prepare to add a truly powerful tool to your arsenal.