Article 12695 of comp.lang.perl: Xref: feenix.metronet.com comp.lang.perl:12695 Newsgroups: comp.lang.perl Path: feenix.metronet.com!news.utdallas.edu!chpc.utexas.edu!cs.utexas.edu!howland.reston.ans.net!agate!ames!pacbell.com!well!nbn!moon!unicom!gilbert From: gilbert@marin.cc.ca.us (Tim L Gilbert) Subject: rtfm: a script for getting FAQs by email Message-ID: Summary: a short perl script to get a FAQ from rtfm.mit.edu Keywords: perl, FAQ, mail, rtfm Organization: College of Marin, Kentfield, CA 94904 X-Newsreader: TIN [version 1.2 PL2] Date: Tue, 12 Apr 1994 22:25:45 GMT Lines: 50 Aloha. This is a simple script I have sitting around in my bin directory; thought I'd share it with y'all. Basically, this just composes a form letter to the mail server mail-server@rtfm.mit.edu. If you type: $ rtfm -i comp.lang.perl you will recieve an index file, and if you say: $ rtfm news.answers/perl-faq/part1 you will get that file. This is a small subset of a larger program I am writing which is a sort of "super form letter composer", and can talk to a variety of mail-servers, including the various ftp- by-email ones. I will post this as soon as I have added that one last feature and worked out that one last bug :). Email if you're interested. Well, here it is: ------------------ snip snip ------------------- #! /usr/bin/perl # rtfm - get a file from the mail-server at mail-server@rtfm.mit.edu. # usage: rtfm [-i] newsgroup[/file] if ( $#ARGV < 0 || $#ARGV > 2 ) { die "usage: rtfm -i newsgroup (index of avaiable FAQs)\n". " or: rtfm newsgroup/ (get )\n"; } $target = 'mail-server@rtfm.mit.edu'; print STDERR "Mailing to $target...\n"; open ( MAIL, "| /usr/ucb/mail -s 'rtfm' $target" ) || die "couldn't pipe to mail!"; if ( $#ARGV == 1 ) { shift; $filename = shift; print MAIL "send usenet/$filename/index\n"; } elsif ( $#ARGV == 0 ) { $filename = shift; print MAIL "send usenet/$filename\n"; } ------------------ snip snip ------------------- P.S.: Yes, I know it should be called rtff. The idea of a newbie being told to "RTFM", then going to the command line and typing it out, and having something actually happen, was too irresistable . -- Tim -- Tim Gilbert College of Marin, Kentfield CA gilbert@marin.cc.ca.us All mistakes my own