What are some practical applications for Perl?

Lowell Hamilton plug-discuss@lists.plug.phoenix.az.us
21 May 2002 15:23:21 -0700


On Tue, 2002-05-21 at 13:10, Mark Berkwitt wrote:
> I'm considering learning Perl but I don't know what Perl will give me.


Perl is a great way to get your feet wet and learn without the
strictness of other languages.  If you already know the basics of
coding, then modular and object oriented techniques can be learned and
implemented with little hassle, again without the strictness at first,
then adding it in later. .. then you can move on to more powerful
things.  CPAN has tons of modules, implementing things from SOAP/XML/RPC
to data munging and templating.  Careful though, it's easy to let the
lack of structure requirements make you a sloppy coder.  Always 'use
strict' and -Tw for anything more than 1 line long.

As a BSD/Linux system administrator,  I used perl extensively for quick
little scripts automating day to day tasks.  A very functional
database-driven app can be built in minutes.  

As a web developer, I found myself getting pissed off at PHP and too
lazy to get into the complications and security thoughts that C/C++
bring in for web applications, so I use mod_perl extensively there too. 
Many people think perl as CGI is dead because they are using the CGI
module or mod_cgi (like a normal CGI application), but when you use
mod_perl handlers or registry scripts instead of plain cgi scripts,
there is less of a performance hit and more control possible than with
other languages... and you can learn all the details about how the
apache internals work =)

I've tinkered with other languages, and each brings it own advantages
and disadvantages to the table ... and it comes a down to personal
preference and what you are looking to get out of it. If you wanna do
web/CGI or many network related functions, look at both mod_perl and php
(and maybe even java since that's the buzzword these days). If you're
going for system administration, perl or shell scripts are awesome and
quick to build.  If you're buildling database or data munging data, perl
rocks hands down ... if you're building gui apps (non-web), don't even
bother with perl. 

Also keep in mind it's interpreted ... so startup time for applications
will be slow, especially if you are loading some big modules .. so
something like a busy inetd-called server or script that is called a few
times a second will make your system crawl (with an exception for
mod_perl cgi applications, which integrate into httpd on startup and
remain compiled).  Daemons aren't too bad, but are difficult to write
and stability is iffy.

Lowell


-- 
: Lowell Hamilton     syz@b r o k e n - b i t . c o m :
: Linux  OpenBSD  Security  QMail  Perl/Mod_perl  SQL :