Commit | Line | Data |
406c51ee |
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 | |