[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] nntp



At 1:04 AM -0500 on 12/19/96, Dan Griffin wrote:


}Hi,
}
}
}I'm messing around with the nntp module with macperl, and for the most part
}everything seems to work fine. When I try to use the date method of a nntp
}object the script fails...
}====================================
}use Net::NNTP;
}use Net::Time;
}
}$nntp = Net::NNTP->new("my.news.server");
}die "Unable to connect to news server : $!" unless $nntp;
}
}$time = $nntp->date();
}
}# other stuff
}
}====================================
}The script works fine (minus the time functionality) when I comment out the
}"$time =.." line, but when I leave it in, I get:
}====================================
}# # Can't locate auto/Net/NNTP/timegm.al in @INC.
}File 'My Drive:MacPerl:lib:AutoLoader.pm'; Line 26
}
}File 'My Drive:MacPerl:libwww-perl-5.05.sit.2 Folder:Net:NNTP.pm'; Line 860
}====================================
}
}Any ideas?

Your script fails under Unix Perl 5.003 as well with the same error
message.  The problem is that Net::NNTP uses timegm but doesn't use
Time::Local, where timegm is defined.  The error message you see is Perl's
last desperate attempt to find timegm.  The fix is to simply place use
Time::Local after use Net::Cmd (line 390) in NNTP.pm.  But now the Unix
version returns -1.  (I can't check it with MacPerl right now.)  This is a
problem with the regular expression on line 861 (line number *after* adding
in use Time::Local) in sub date.  Change the (\d{4}) to \d\d(\d\d), and
then things work just fine.  I've notified Graham Barr about the bugs, and
I'll update the MacPerl ready libnet soon.

This bring up a question, which I'll look into shortly.  ->date is
documented to return seconds past the Unix zero of time.  Because you're
using Time::Local under MacPerl, you get the number of seconds past the Mac
zero of time, which is different.  I'll have to check the RFC for NNTP and
see if the Unix zero of time is required.  If so, another change will be
necessary.

}
}- Dan Griffin
}  dang@cs.brandeis.edu


--------
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693
Greenbelt, MD 20770
schinder@pjstoaster.pg.md.us