Perl is an interpreted programming language that is especially good for text file processing, system management tasks, and many other things. Here are some small Perl programs of mine that I thought I'd share. Feel free to use, modify, or redistribute these as you'd like. If you have questions, comments, patches, or anything else you'd like to enlighten me about these programs, please e-mail me.
[ Caesar | Link Page Maker | downloader.pl | Documentation Generator | Scripts used to create this site ]
Caesar is a simple program to decrypt Caesar cyphers. It mimics the BSD Game caesar. (more info on Caesar cyphers.)
Link Page Maker (mklinkpg.pl) generates a links page given a template file and a list of URLs. It does this by fetching each URL in the list and extracting its title and description. View sample output.
downloader.pl is a simple program to download web pages recursively. The web pages are saved in directories named after their address (e.g. a page with URL http://www.sentex.net/~ajy/perl/index.html would be saved as index.html in the directory www.sentex.net/~ajy/perl/ (relative to the current directory). This program is intentionally simple; if you're interested in something with lots of options, I recommend sirobot. In contrast to sirobot, downloader.pl emphasizes
To run downloader.pl, you need the libwww-perl library, which can be found at CPAN.
The command syntax for downloader.pl is as follows:
downloader.pl URL depth regexp
Where URL is the URL to be downloaded,
depth is the number of levels
of links to follow (to just download URL, specify 0 for
depth, and regexp is a regular expression that
must be matched before a URL is fetched.
check_link.pl is a very simple program to check all links on a web page to determine if they're broken or if they're redirected elsewhere. Requires LWP.
This program is a work-kind-of-in-progress (I haven't made too many improvements lately) that automatically generates documentation on the functions in source code from the comments in the code.
HTMLBeautify.pm is a module that beautifies HTML code by adding extra newlines, spacing, and/or indentation, and can also remove comments or SGML declarations if desired. It can be found at SourceForge's snippet library.
Facts.pm is a module that is intended to be used with Darren Miller's Filepp, a file pre-processor. This module adds headers and footers to the HTML, as well as updating a Makefile in the current directory. I use this module when updating my Interesting Facts pages.
chlist.pl is a rather rough program that I wrote to help to create my Calvin and Hobbes Index. It helps with generating an index. Feel free to try it out and play with it, although your mileage may vary. It requires Perl/Tk, which can be found at CPAN. This is the original version, written on December 20/21, 2000.
O'Reilly's official Perl site is a great Perl resource. If you're looking for Perl scripts, I recommend the The Perl Archive. If you're looking for modules, try CPAN, the Comprehensive Perl Archive Network.