home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _009a4a3f492a616326f96f3fc9533778 < prev    next >
Encoding:
Text File  |  2004-06-01  |  616 b   |  41 lines

  1. #!/usr/local/bin/perl
  2.  
  3. use blib;
  4. use Getopt::Long;
  5. use Net::NNTP;
  6.  
  7. $opt_debug = undef;
  8.  
  9. GetOptions(qw(debug));
  10.  
  11. @groups = @ARGV;
  12.  
  13. $nntp = Net::NNTP->new('news', Debug => $opt_debug ? 1 : 0);
  14.  
  15. if($subs = $nntp->newsgroups)
  16.  {
  17.   print join("\n",(keys %$subs)[0 .. 10]),"\n";
  18.  }
  19.  else
  20.  {
  21.   warn $nntp->message;
  22.  }
  23.  
  24. foreach $group (@groups)
  25.  {
  26.   $new = $nntp->newnews(time - 3600, lc $group);
  27.  
  28.   if(ref($new) && scalar(@$new))
  29.    {
  30.     print@{$news}[0..3],"\n"
  31.         if $news = $nntp->article($new->[-1]);
  32.  
  33.     warn $nntp->message
  34.          unless $news;
  35.    }
  36.  }
  37.  
  38. $nntp->quit;
  39.  
  40.  
  41.