Backlog

ziggy on 2002-03-27T00:31:55

I've been a tad busy the last two weeks or so. So much so that I fell behind on a few days' worth of journal postings. So I snuck a few moments here and there this weekend to catch up on that. Fortunately, I set my messaging options to send email for a lot of the postings I was missing. Following those links was much simpler than grovelling through web pages. :-)

Here's the script I whipped up to scan through the postings I missed on use.perl. It's got a few bugs (like attempting to read past the end of a mailbox), but mostly works to display one URL at a time.

#!/usr/bin/perl

use strict;
use Mail::Box::Manager;

my $mgr = new Mail::Box::Manager;
my $mbox = $mgr->open(folder => 'useperl',  access => 'rw');

my $i = 0;
do {
	my $msg = $mbox->message($i++);

	my ($url) = $msg->body() =~ m{(http:.*?$)}sm;
	system "mozilla -remote 'openurl($url)'" if $url;
	print $url;

	$msg->delete();
} while (<>);

$mbox->write();

One other bug was that it doesn't visit each message in chronological order. Not a bug really, since I was able to view the mailbox in mutt in the proper order, and resave all of the messages in the appropriate order and continue on.

Enjoy!