Home page of Eric Pement

Home > perl.htm

 

The Perl programming language

Perl is a powerful tool, as common to web developers and GNU/Linux "power users" as pneumatic impact wrenches are to a mechanic. Perl is an all-purpose "glue language," and its flexibility makes it a choice utility capable of doing lots of stuff. Its power is accompanied by something of a learning curve, which means that it takes longer to learn Perl than it does (say) sed or awk.

Perl links and references

  • Download Perl - For Windows users, there are 3 different versions to choose from: ActiveState Perl, Strawberry Perl, and DWIM Perl. Installing ActiveState or Strawberry Perl will require over 200 megs of space; DWIM ("Do What I Mean" Perl) will occupy about 300 MB when it is unpacked. It comes with Padre, the Perl IDE.
  • Tiny Perl - Going for small and compact, TinyPerl puts most of the things you want from Perl (minus nearly all the Perl modules) into 3 small files with a total size of less than 710 Kilobytes. What's even more amazing, this version of Perl claims you can generate an *.EXE file from your perl script. Download either the 32-bit Windows installation or the plain ZIP files from here
  • Perl.com - latest news about Perl, Perl conferences, Perl development
  • Perl.org - home page for learning, docs, communities, cpan, opportunities, etc.
  • Perl Mongers
  • Perl Monks
  • Online Perl Documentation - the core Perl docs in HTML format

xhtmlpp

This web site is put together by a combination of text files and semi-html files, and arranged with automatic headers and navigation elements by an HTML pre-processor called xhtmlpp (tar.gz archive)

This utility was based on an earlier tool called htmlpp written by the late Pieter Hintjens, a free sofware proponent and programmer. Kathryn Andersen revised it as xhtmlpp for her web site, katspace.com, but she doesn't use it any more and isn't interested in maintaining it. xhtmlpp and htmlpp are built on top of Libero, a "state machine" which generates its own code which (because it's machine generated) is really hard to follow, even if you really like perl.

At some point in the future, I hope to produce a guide to how I use xhtmlpp, and may create a "beginner's guides" to installing it. For the time being, it's enough just to make the source available.

Make

If you download and install modules from CPAN (the Comprehensive Perl Archive Network), you probably use the cpan script to locate the files you want, download, test, and then install them. If you don't use cpan, you should learn about it. Type "man cpan" from a Unix shell prompt to find out more.

In the "old" days, before cpan was as robust and intelligent as it is now, perl modules were installed with the "make" utility. In a Windows environment, "make" worked rather poorly, so Microsoft finally released a new version, "nmake". (The name isn't that weird; remember that nroff is named from "new roff."). If you need these old utilities, here is Microsoft's FTP site for nmake15.exe. NMAKE15.EXE is a self-extracting zip file. When executed, it will extract three files to your disk: nmake.exe, nmake.err, and readme.txt. Move nmake.* to c:\perl\bin, which should be on the path. Then you may run this standard command set for installing perl modules:

   perl Makeinstall.PL
   nmake
   nmake test
   nmake install

Things I wrote for Perl

Here are some basic Perl scripts I'd like to share.

  • reform.pl - a script to reformat paragraphs
  • colrm.pl - column remove: a script to delete specified columns of text
  • endnote.txt - If you write documents in plain ASCII (with Emacs, vim, EditPad, etc.), and want to have note refrerences in your documents, and also wish you could move those note references around without renumbering everything, this is for you. Basically, you use references like this[##] in your text, putting the actual citation (Dante, Book 3, sect. 2) directly below the paragraph. Rearrange the document to your heart's delight. When you're all finished, use this perl script to sequentially number all your references, gather your notes together, and print them at the end of the file with numbers corresponding to the in-text references. Totally cool. Eric Meyer thought of it, and I wrote it for both awk and perl. The version here (ver. 142) is a major new version of what I posted a few years ago.

    The same script is also available in awk if you'd rather.

  • biblink_v1.28.pl - I call this "Bible Link". At over 1500 lines, it's fairly long, and it took many hours of coding and testing. It creates HTML hyperlinks to Bible passages in a file. It handles easy references like "John 3:16", moderate references like "Jn 8:24, 12; 10:1, 8-10" and hard references like "chapter 6" and "(1:7, 9; 2:1-2)", even if the components span more than one line. All these will be matched and hyperlinked. This is an interactive program (required for hard references where the book name is not known). However, the script remembers the last book and chapter last used and suggests a link; you type 'y' to accept it, or you can change it.

    The script was developed at Moody Bible Institute in mid-2002. It recognizes all common and uncommon abbreviations for books of the Bible, and even has a switch to replace "l" (lower-case L) with "1" (one) where a number was probably intended. The script contains perl POD (Plain Old Documentation), which you can read here for further details.
  • biblinkXML_v0.6.pl - After developing Bible Link, our team switched to an XML format and we began using XMLSpy, which interfered a bit with Bible Link. Also, we had been creating links that depended on Bible Gateway but they changed their query structure, so I had to revise how the links were submitted. So, I made enough changes that I decided to "downgrade" the version number to 0.6, even though this version came out in 2005.
  • scripturizer.pm - While I was working on "Bible Link," an entirely independent effort by another Perl developer was underway to also locate Bible references and generate HTML hyperlinks to them. This was called "Scripturizer," written by Dean Peters and others, and released as Perl module. Since these two scripts have a similar aim, it seems nice to make this effort available to web developers who use Perl. Thanks, Dean.
  • renx - This is a slightly improved version of renx, the nice mass filename rename utility written by Tom Christensen and Nate Torkington. I added some additional switches (especially one to show results without executing), and made sure it would work in Windows and also under Cygwin. I also added better reporting and help messages.

I continue to write medium to large scripts in Perl now and then, all for my current employer, and if circumstances allow maybe I can share them with you at a later date.

Discussion forums, newsgroups



These pages created with GNU Emacs, xhtmlpp, Take Command, and Altap Salamander. Icons courtesy of Qbullets
Last modified: 2014-11-11