Not a bad idea. However, I don't see that this is a common enough type of thing used on the site to be necessary (or for
vroom or whoever to spend the time setting it up). On another note, I believe I once saw a snippet for grabbing an RFC straight off the FTP. *digs through some stuff*
Ok, found the code. Here it is... *Disclaimer* I didn't write this, but I don't remember who did. If it was you, take credit for it in reply to this post.
#!/usr/local/bin/perl -w
# example usage: rfc 1459 (gets the IRC RFC)
use strict;
$|++;
use LWP::Simple;
use HTTP::Status;
die("usage: rfc <rfc#>\n") unless defined($ARGV[0]);
my $rfcnum=$ARGV[0];
my $base="ftp://ftp.rfc-editor.org/in-notes/rfc";
my $rfcurl=$base.$rfcnum.".txt";
my $rfcdir="$ENV{HOME}/rfcs";
my $rfcfile="${rfcdir}/rfc${rfcnum}.txt";
my $rfc;
my $rc=mirror($rfcurl,$rfcfile);
# any 4xx or 5xx error probably means we got no RFC
if($rc < 400) {
open(RFC,"<$rfcfile") or die("open($rfcfile): $!\n");
local $/ = undef;
$rfc=<RFC>;
close(RFC);
print "$rfc";
} else {
print "Failed to fetch ${rfcurl}: $rc ", status_message($rc), "\n"
+;
}
__END__
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.