Mother of Perl | 5 | WebReference

Mother of Perl | 5

After managing to get versions of your scripts working as BBEdit filters, I decided to tackle getting working as a BBEdit include file.

The format is somewhat similar to Server Side Includes in appearance, but the functionality it somewhat different, due to the way BBEdit uses AppleEvents to send data to MacPerl.

AppleEvents expects data to be in key/value pairs, which means that the contents @ARGV must be coerced to a hash in Perl. First, however, one sets up the BBEdit include statment, thus:

<!-- #bbinclude #val1#="" --> <!-- end bbinclude -->

The "end" statment is needed so that the whole include statement becomes "persistant", that is, it doesn't get replaced by the results of the script, but acts as a container for it.

Since @ARGV doesn't hold the single value the original script expects, line #19:

die "Usage: (<RSS file> | <URL>)\n" unless @ARGV == 1;

will always cause the script to die. Until I find some other test, I've just pulled this line from the script.

The following version does some minimal reporting in the form of HTML comments, and is also cleaned-up in the way it outputs HTML (I think that the formatting I'm using here is a little more consistant, and I'll probably work on making it even more so). One insignifigant modification is that I like the tables slightly narrower (184 vs. 200 pixels). My justification for this requires more explanation than I can fit in a single email. I also don't like the way that text wraps in either NS or IE when <li> is used on its own. One signifigant change is that I've made the output look more consistant between NS and IE. These are mostly tweaks to the HTML, and not to the script itself.

Produced by Jonathan Eisenzopf and URL: