1#!/usr/bin/perl 2# $File: //depot/libOurNet/BBS/eg/bbsget $ $Author: autrijus $ 3# $Revision: #1 $ $Change: 1 $ $DateTime: 2002/06/11 15:35:12 $ 4 5$VERSION = '0.01'; 6 7use strict; 8use OurNet::BBS 1.64; 9 10=head1 NAME 11 12bbsget - Fetch and print articles in a remote Telnet-BBS 13 14=head1 SYNOPSIS 15 16B<bbsget> S<[ B<-d> ]> I<bbsname> I<board> S<I<login>[:I<password>]> S<[ I<recno>... ]> 17 18=head1 DESCRIPTION 19 20This script logs into a remote BBS supported by the B<BBSAgent> 21backend. The I<bbsname> should be one of the C<*.bbs> descriptors, 22and I<board> is any board name within that BBS. 23 24The third argument is usually C<guest>, but it may also be a 25colon-delimited I<login>:I<password> string. 26 27You may specify one or more I<recno>, or accept the default -1 28(the last article). Note that it counts from 0, and negative 29indices means to count backwards. 30 31Debug messages are printed if the B<-d> flag is specified. 32 33=head1 EXAMPLE 34 35To display the last article of melix board in the Elixus BBS: 36 37 % ./bbsget elixus melix 38 39=cut 40 41$OurNet::BBS::DEBUG = shift if $ARGV[0] eq '-d'; 42 43my ($site, $board, $login) = splice(@ARGV, 0, 3); 44 45die "Usage: $0 [-d] bbsname boardname login[:password] [recno...]\n" 46 unless $site and $board; 47 48my $BBS = OurNet::BBS->new({ 49 backend => 'BBSAgent', 50 bbsroot => $site, 51 login => $login, 52}); 53 54my $brd = $BBS->{boards}{$board}{articles}; 55 56foreach my $recno (@ARGV ? @ARGV : -1) { 57 my $art = $brd->[$recno]; 58 59 foreach my $key (sort keys(%{$art->{header}})) { 60 print "$key: $art->{header}{$key}\n"; 61 } 62 63 print "-" x 80; 64 print $art->{body}; 65} 66 67__END__ 68 69=head1 SEE ALSO 70 71L<OurNet::BBS>, L<OurNet::BBSAgent>. 72 73=head1 AUTHORS 74 75Autrijus Tang E<lt>autrijus@autrijus.orgE<gt> 76 77=head1 COPYRIGHT 78 79Copyright 2001-2002 by Autrijus Tang E<lt>autrijus@autrijus.orgE<gt>. 80 81This program is free software; you can redistribute it and/or 82modify it under the same terms as Perl itself. 83 84See L<http://www.perl.com/perl/misc/Artistic.html> 85 86=cut 87