Re: retrieving news messages



On Thu, 05 Jul 2007 12:25:20 -0700 in comp.lang.perl.misc, Joe Smith
<joe@xxxxxxxxx> wrote,
my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} );
die "Unable to create NNTP object" unless $nntp;

You have got to get those two statements working before proceeding
any further.

It appears to me, that style of passing arguments to Net::NNTP->new
cannot work. I see this code in Net/NNTP.pm:

sub new
{
my $self = shift;
my $type = ref($self) || $self;
my ($host,%arg);
if (@_ % 2) {
$host = shift ;
%arg = @_;
} else {
%arg = @_;
$host=delete $arg{Host};
}


The above looks wrong to me; I think it ought to be more like

if (not (@_ % 2)) {

However, I'm still something of a Perl newbie, and am not quite sure
of all that I am looking at here. It appears that the constructor
fails to pick up the Host argument, but then it goes on to look for
the NNTPSERVER environment variable and use that, as documented.
I guess that everyone who got it to work had some such luck.

What do you all think?
.



Relevant Pages

  • Re: retrieving news messages
    ... die "Unable to create NNTP object" unless $nntp; ... my $self = shift; ... $host = shift; ... Your constructor fails. ...
    (comp.lang.perl.misc)
  • Re: retrieving news messages
    ... Wade Ward wrote: ... die "Unable to create NNTP object" unless $nntp; ... You have got to get those two statements working before proceeding ...
    (comp.lang.perl.misc)