spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / perl / scripts / bbi_rss2html.html

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

After managing to get versions of your scripts working as BBEdit filters, I decided to tackle getting rss2html.pl 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 rss2html.pl #val1#="http://somesite.com/somefile.rdf" --> <!-- 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: rss2html.pl (<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

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business

URL: http://www.webreference.com/perl/scripts/