Great ideas! Here's my implementation of the first idea:
#!/usr/bin/perl -w
# example usage: rfc 1459 (gets the IRC RFC)
use strict;
use LWP::Simple qw(get);
die("usage: rfc <rfc#>\n") unless defined($ARGV[0]);
my $rfcnum=$ARGV[0];
my $base="http://www.rfc.net/rfc";
my $rfcdir="$ENV{HOME}/rfcs";
my $rfcfile="${rfcdir}/rfc${rfcnum}.txt";
my $rfc;
if(-e $rfcfile) {
open(RFC,"<$rfcfile") or die("open($rfcfile): $!\n");
local $/ = undef;
$rfc=<RFC>;
close(RFC);
} else {
$rfc=get($base.$rfcnum.".txt");
open(RFC,">$rfcfile") or die("open($rfcfile): $!\n");
print RFC "$rfc";
close(RFC);
}
print "$rfc";
__END__
(
Update: Just when I thought I had it nailed, better ideas crop up. Now reading docs to retool to
merlyn's idea below. (tho rfc.net doesn't appear to return the proper headers that support
mirror()))
--
Me spell chucker work grate. Need grandma chicken