![]()
Welcome to my Perl page. Here are some goodies related to the
Perl programming language.
![]()
I wrote the CGI Programming in Perl
chapter and some other CGI-related stuff for Unix Unleashed,
Internet Edition, published by SAMS. (Please don't hold
that against me.) Given that the amount of time most authors
have to produce technical books these days is about a third of
what it ought to be, errors tend to find their way to print. If
you find any errors in anything with my name attached to it, please let me
know so I can make note of
corrections here.
![]()
Perl is a wonderfully powerful language that is particularly
well suited to writing tools for the Internet. Its portability,
flexibility, speed, and powerful text processing capabilities
make it ideal for many tasks which are very difficult to do in
other languages.
I hear you already... ``Didn't you write an essay about how great and wonderful Java is?'' In fact, yes I did. Java and Perl are two different programming languages, with very different views of the world. The result is that some problems are better solved in Java, while others are better solved in Perl. Use the right tool for the job. (And, truth be told, the point of my essay was more about the importance of a single, unified Java Virtual Machine (JVM) than about the Java programming language. I'm rather looking forward to having my Perl programs run on any platform where the JVM can be found, without modification, without recompilation, and without a headache.)
![]()
Here are some Perl programs that might be of interest.
Hopefully, you'll find something here that demonstrates
something you're interested in, and you can see how to do it
safely.
Most of these are CGI programs, though I'm sure I'll park lots of other stuff here in the future. Obligatory warning (that you shouldn't ignore): Remember, CGI scripts are programs that an untrusted user invokes on your system. Bad people will try to trick it into doing bad things. Remember to think about the security of what you're doing, not just the functionality!
crfingerd is a Perl replacement for your
system's finger daemon. It was written so that local users
whose directories were part of a chroot(2)'d
could work with the finger service. This works by accepting
the account to be finger'd on STDIN (from the socket) and
performing a lookup. If the user is local, finger is run
against the account and the result returned. If the user is
chroot'd, a wrapper that will run the finger properly is
invoked. If the user is not chroot'd, normal finger will be
run. If the user does not exist, an error is returned. You
can install this by saving the file (with correct permissions,
i.e., read and execute) in
/usr/local/sbin/crfingerd and then replacing the
finger line in /etc/inetd.conf with
this:
finger stream tcp nowait nobody /usr/local/sbin/crfingerd cfingerdThen send a SIGHUP to the
inetd process, and
you're on your way.
httpd-p takes a list of web sites from a file,
queries them all, figures out which server each runs, and then
reports aggregate statistics, each type of web server found,
and how many of each. Maybe in the future, I'll make a
webified version of this so you can try it right online. But
for the time being, you'll have to download it, unwind it, and
use it. A Makefile is included for your
convenience in testing, installation, and making
documentation.
dig
command. It demonstrates the following:
$ENV{'PATH'}. (In my case, I did this to
work on Linux, 4.4BSD, IRIX, and Solaris.)
CGI.pm to parse user input and
generate HTML.
GET. If you're doing former, you'll have your
answers processed; if you do the latter, you'll be presented the
fill-out form. Try it or,
if you prefer, view the source
and the comments therein.
perldoc utility to create inline
documentation.