This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
avoid v-strings with require/use
[perl5.git] / lib / Net / t / nntp.t
1 #!./perl -w
2
3 use Net::Config;
4 use Net::NNTP;
5 use Net::Cmd qw(CMD_REJECT);
6
7 unless(@{$NetConfig{nntp_hosts}} && $NetConfig{test_hosts}) {
8     print "1..0\n";
9     exit;
10 }
11
12 print "1..4\n";
13
14 my $i = 1;
15
16 $nntp = Net::NNTP->new(Debug => 0)
17         or (print("not ok 1\n"), exit);
18
19 print "ok 1\n";
20
21 my $grp;
22 foreach $grp (qw(test alt.test control news.announce.newusers)) {
23     @grp = $nntp->group($grp);
24     last if @grp;
25 }
26
27 if($nntp->status == CMD_REJECT) {
28     # Command was rejected, probably because we need authinfo
29     map { print "ok ",$_,"\n" } 2,3,4;
30     exit;
31 }
32
33 print "not " unless @grp;
34 print "ok 2\n";
35
36
37 if(@grp && $grp[2] > $grp[1]) {
38     $nntp->head($grp[1]) or print "not ";
39 }
40 print "ok 3\n";
41
42 if(@grp) {
43     $nntp->quit or print "not ";
44 }
45 print "ok 4\n";
46