my $foo = Net::Server::NNTP->new();
...
-=head1 EXPORT
-
-Nothing is exported.
-
-A list of functions that can be exported. You can delete this section if
-you don't export anything, such as for a purely object-oriented module.
-
=cut
our $article_re = qr/\<[^\s\>]+\@[^\s\>]+\>/; # rfc 1036 2.1.5
$s->article_number($n);
} elsif (!@args) {
($g, $n) = $s->pointer;
- $s->log(4, "fetching ($g $n)");
return $s->response(412) unless defined $g;
return $s->response(420) unless defined $n;
+ $s->log(4, "fetching ($g $n)");
$id = $s->fetch_stat($g,$n);
return $s->response(420) unless defined $id;
} else {
my $ok = 0;
return $s->response(501) unless $id =~ /($article_re)/;
- return $s->response(430) if $s->fetch_stat($id);
+ return $s->response(435) if $s->fetch_stat($id);
return $s->response(436) unless $s->permit_posting;
$s->response(335);
'OVER MSGID' => '',
'LIST ACTIVE NEWSGROUPS OVERVIEW.FMT ACTIVE.TIMES HEADERS' => '',
STREAMING => '',
+ IMPLEMENTATION => 'if.org newsd',
);
our %hdrs = (
# TODO use a config parameter optionally here
my $dsn = $ENV{'DBI_DSN'};
- $dsn = 'dbi:Pg:dbname=news' unless defined $dsn;
+ $dsn = qq{dbi:Pg:dbname=news} unless defined $dsn;
$s->log(4, "connecting to $dsn");
- $s->{db} = DBI->connect($dsn,'','',{AutoCommit => 0,RaiseError=>1});
+ eval {
+ $s->{db} = DBI->connect($dsn,'','',{AutoCommit => 0,RaiseError=>1});
+ $s->log(4, "Can't connect to DB: $DBI::errstr") unless $s->{db};
+ };
+ if ($@) {
+ $s->log(4, "Can't connect to DB: $DBI::errstr");
+ die $@;
+ }
+ $s->log(4, "connected to $dsn");
+
+ # TODO abort if can't connect
$s->{db}->{PrintError} = 0;
$s->{db}->do("set CLIENT_ENCODING to 'SQL_ASCII'");