Article Listing 1 Listing 2 mar2004.tar

Listing 2 newslib.pl

package newslib;

# standard procedures

use Socket;
use Net::NNTP;
use Time::HiRes ("gettimeofday");

%hosts=('news1'=>
    {
  'servers'=>['news.isp.tld']
       }
       );

sub open_connection
# $_[0] = $host
# $_[1] = $port
{
    $ipaddr=$_[0];
    $c= Net::NNTP->new("$ipaddr");
}

sub close_connection
{
    $c->quit;
}


1;