1 # contest.pl - contest calendar from www.sk3bg.se/contest
2 # used with 1 argument: sh/contest <yearandmonth>
3 # e g sh/contest 2002sep
4 # Tommy Johansson (SM3OSM) 2002-07-23
5 # New version using Net::Telnet 2003-03-09
10 my ($self, $line) = @_;
12 #return (1, "usage: sh/contest <year_and_month>, e g sh/contest 2002sep ") unless $line;
18 # trying to make the syntax abit more user friendly...
19 # and yes, I have been here and it *is* all my fault (dirk)
21 my ($m,$y) = $line =~ /^([a-z]+)\s*(\d+)/;
22 ($y,$m) = $line =~ /^(\d+)\s*([a-z]+)/ unless $y && $m;
24 ($m,$y) = (gmtime)[4,5];
25 $m = lc $DXUtil::month[$m];
28 $y += 2000 if $y <= 50;
29 $y += 1900 if $y > 50 && $y <= 99;
30 $m = substr $m, 0, 3 if length $m > 3;
31 $m = 'oct' if $m eq 'okt';
32 $m = 'may' if $m eq 'mai' || $m eq 'maj';
35 dbg($mon) if isdbg('contest');
37 my $filename = "c" . $mon . ".txt";
38 my $host = $Internet::contest_host || 'www.sk3bg.se';
40 my $url = $Internet::contest_url || "http://www.sk3bg.se/contest/text";
43 my $t = new Net::Telnet (Telnetmode => 0);
45 $t->open(Host => $host, Port => $port, Timeout => 15);
49 push @out, $self->msg('e18','sk3bg.se');
53 my $notfound = $t->getline(Timeout => 10);
54 if ($notfound =~ /404 Object Not Found/) {
55 return (1, "there is no contest info for $mon")
61 push @out, $t->getline(Timeout => 10);
64 push @out, $self->msg('e18', 'sk3bg.se');