Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

gav (2710)

gav
  (email not shown publicly)
http://www.estey.com/
AOL IM: flufflegavin (Add Buddy, Send Message)

Hacker in NYC.

Journal of gav (2710)

Wednesday April 09, 2003
12:55 PM

mt plugins and perl stuff

[ #11552 ]

I've fixed a long outstanding bug* in my InterceptVector MT Plugin. It took me forever to fix it because I was being really dumb. I kept getting an error with the <$MTWeatherHumidity$> tag that I just couldn't figure out. The problem was that on both my server and my laptop I have this plugin and my Weather::Underground plugin installed and they were both trying to create a tag called the same thing. In other news Weather::Underground is broken due to slight changes to the HTML it is scraping.

* Thanks to Vek

I've never really made much use of $/ until recently. I've really only ever set it to undef to slurp files but recently I've found some cunning uses for the input record separator.

For example a quick hack to convert the results from mysqldump into a CSV file to import into Access:

local $/ = ');';
while (<$in>) {
    if (my ($line) = /INSERT INTO \w+ VALUES \((.+?)\);$/s) {
        $line =~ s/NULL/''/g;
        print {$out} $line, "\n";
    }
}

I had a huge XML document that I wanted to split into record based files (as it was broken XML):

local $/ = '</r>';
while (my $rec = <$in>) {
    # we've got a whole record
}

It's not that exciting or new but it's another tool for the toolbox.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.