lib/Net/demos/nntp.mirror libnet
lib/Net/demos/pop3 libnet
lib/Net/demos/smtp.self libnet
-lib/Net/demos/snpp libnet
lib/Net/demos/time libnet
lib/Net/Domain.pm libnet
lib/Net/FTP.pm libnet
lib/Net/hostent.pm By-name interface to Perl's builtin gethost*
lib/Net/hostent.t See if Net::hostent works
lib/Net/Hostname.eg libnet
-lib/Net/libnet.ppd libnet
lib/Net/libnetFAQ.pod libnet
lib/Net/netent.pm By-name interface to Perl's builtin getnet*
lib/Net/netent.t See if Net::netent works
lib/Net/POP3.pm libnet
lib/Net/protoent.pm By-name interface to Perl's builtin getproto*
lib/Net/protoent.t See if Net::protoent works
-lib/Net/README.config libnet
lib/Net/README.libnet libnet
lib/Net/servent.pm By-name interface to Perl's builtin getserv*
lib/Net/servent.t See if Net::servtent works
+Change 625 on 2001/08/17 by <gbarr@pobox.com> (Graham Barr)
+
+ Doc updates and add cc and bcc as aliases for recipient
+
+Change 624 on 2001/08/17 by <gbarr@pobox.com> (Graham Barr)
+
+ Don't set ENV variables
+
+Change 623 on 2001/08/17 by <gbarr@pobox.com> (Graham Barr)
+
+ Support mixed case in the EHLO response
+
+Change 622 on 2001/08/06 by <gbarr@pobox.com> (Graham Barr)
+
+ Documentation update
+
+Change 621 on 2001/08/06 by <gbarr@pobox.com> (Graham Barr)
+
+ Set the status if command returns due to the connection being closed
+
+Change 620 on 2001/08/06 by <gbarr@pobox.com> (Graham Barr)
+
+ Fix for _msg_spec when passed the same msg number twice, pass N instead of N-N
+
+Change 619 on 2001/05/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Remove DummyInetd
+
+Change 618 on 2001/05/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Move snpp into its own distribution
+
+Change 615 on 2001/05/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Move PH to its own dist
+
+Change 614 on 2001/05/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Move TFTP out of libnet
+
+Change 612 on 2001/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Support some non standard servers that return more than
+ just a number in response to SIZE. But the size must be
+ the last thing on the response line [Jeffery W Long]
+
+Change 603 on 2000/10/06 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::Config
+ - Added documentation for ftp_firewall_type
+
+Change 574 on 2000/08/24 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::FTP
+ - Make listen socket listen on same interfacce as the command connection
+ this fixes a problem when going via a SOCKS firewall
+
+Change 458 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::Cmd, Net::FTP
+ - Support for os390, modified from a patch from Dan Campbell
+
+Change 455 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::Domain
+ - silence warnings on Win32 that domainname does not exist
+
+Change 454 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::FTP
+ - More error checking in ->get()
+
+Change 453 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::FTP
+ - update pattern to dig out unique filename from stou
+
+Change 452 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ t/ftp.t
+ - silently pass if the stor to /pub fails
+
+Change 451 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::FTP
+ - Add Timeout to listen socket
+
+Change 450 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Makefile.PL
+ - only add ppd conditional on perl version
+
+Change 449 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Fixed mput example in FAQ to use glob()
+
+Change 448 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Update README to reflect new way Configure works
+
+Change 447 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::Config
+ - Check that $home is defined before we use it
+
+Change 446 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::FTP
+ - add link to autoftp example
+
+Change 445 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::FTP::A, Net::FTP::I
+ - Move the timeout check into the loop to prevent hanging
+ on write.
+
+Change 444 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::Cmd, Net::FTP::A, Net::FTP::I
+ - MacOS does not like the setting of $SIG{PIPE} so check $^O
+
+Change 432 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ POD cleanup
+
+Change 431 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::NNTP
+ - Allow a filehandle to be passed to article, head and body
+
+Change 430 on 2000/03/29 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::TFTP
+ - There is no quit method, so don't document one
+
Change 402 on 2000/03/23 by <gbarr@pobox.com> (Graham Barr)
Net::Config
-# Net::Cmd.pm
+# Net::Cmd.pm $Id: //depot/libnet/Net/Cmd.pm#25 $
#
# Copyright (c) 1995-1997 Graham Barr <gbarr@pobox.com>. All rights reserved.
# This program is free software; you can redistribute it and/or
use vars qw(@ISA @EXPORT $VERSION);
use Carp;
-$VERSION = "2.18";
+BEGIN {
+ if ($^O eq 'os390') {
+ require Convert::EBCDIC;
+# Convert::EBCDIC->import;
+ }
+}
+
+$VERSION = "2.19";
@ISA = qw(Exporter);
@EXPORT = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING);
my %debug = ();
+my $tr = $^O eq 'os390' ? Convert::EBCDIC->new() : undef;
+
+sub toebcdic
+{
+ my $cmd = shift;
+
+ unless (exists ${*$cmd}{'net_cmd_asciipeer'})
+ {
+ my $string = $_[0];
+ my $ebcdicstr = $tr->toebcdic($string);
+ ${*$cmd}{'net_cmd_asciipeer'} = $string !~ /^\d+/ && $ebcdicstr =~ /^\d+/;
+ }
+
+ ${*$cmd}{'net_cmd_asciipeer'}
+ ? $tr->toebcdic($_[0])
+ : $_[0];
+}
+
+sub toascii
+{
+ my $cmd = shift;
+ ${*$cmd}{'net_cmd_asciipeer'}
+ ? $tr->toascii($_[0])
+ : $_[0];
+}
+
sub _print_isa
{
no strict qw(refs);
{
my $cmd = shift;
- return $cmd unless defined fileno($cmd);
-
+ unless (defined fileno($cmd))
+ {
+ $cmd->set_status("599", "Connection closed");
+ return $cmd;
+ }
+
+
$cmd->dataend()
if(exists ${*$cmd}{'net_cmd_lastch'});
if (scalar(@_))
{
- local $SIG{PIPE} = 'IGNORE';
+ local $SIG{PIPE} = 'IGNORE' unless $^O eq 'MacOS';
+
+ my $str = join(" ", map { /\n/ ? do { my $n = $_; $n =~ tr/\n/ /; $n } : $_; } @_);
+ $str = $cmd->toascii($str) if $tr;
+ $str .= "\015\012";
- my $str = join(" ", map { /\n/ ? do { my $n = $_; $n =~ tr/\n/ /; $n } : $_; } @_) . "\015\012";
my $len = length $str;
my $swlen;
-
+
$cmd->close
unless (defined($swlen = syswrite($cmd,$str,$len)) && $swlen == $len);
my $partial = defined(${*$cmd}{'net_cmd_partial'})
? ${*$cmd}{'net_cmd_partial'} : "";
my $fd = fileno($cmd);
-
+
return undef
unless defined $fd;
${*$cmd}{'net_cmd_partial'} = $partial;
+ if ($tr)
+ {
+ foreach my $ln (@{${*$cmd}{'net_cmd_lines'}})
+ {
+ $ln = $cmd->toebcdic($ln);
+ }
+ }
+
shift @{${*$cmd}{'net_cmd_lines'}};
}
=head1 SYNOPSIS
use Net::Cmd;
-
+
@ISA = qw(Net::Cmd);
=head1 DESCRIPTION
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
+=for html <hr>
+
+I<$Id: //depot/libnet/Net/Cmd.pm#25 $>
+
=cut
+# Net::Config.pm
+#
+# Copyright (c) 2000 Graham Barr <gbarr@pobox.com>. All rights reserved.
+# This program is free software; you can redistribute it and/or
+# modify it under the same terms as Perl itself.
package Net::Config;
-# $Id: //depot/libnet/Net/Config.pm#6 $
require Exporter;
use vars qw(@ISA @EXPORT %NetConfig $VERSION $CONFIGURE $LIBNET_CFG);
@EXPORT = qw(%NetConfig);
@ISA = qw(Net::LocalCfg Exporter);
-$VERSION = "1.04";
+$VERSION = "1.05"; # $Id: //depot/libnet/Net/Config.pm#9 $
eval { local $SIG{__DIE__}; require Net::LocalCfg };
}
}
if ($< == $> and !$CONFIGURE) {
- use File::Spec;
- my $home = eval { (getpwuid($>))[7] } || $ENV{HOME} || $ENV{HOMEDRIVE} || $ENV{HOMEPATH} || File::Spec->curdir;
- $file = File::Spec->catfile($home, ".libnetrc");
- $ref = eval { do $file } if -f $file;
- %NetConfig = (%NetConfig, %{ $ref })
- if ref($ref) eq 'HASH';
+ my $home = eval { (getpwuid($>))[7] } || $ENV{HOME};
+ if (defined $home) {
+ $file = $home . "/.libnetrc";
+ $ref = eval { do $file } if -f $file;
+ %NetConfig = (%NetConfig, %{ $ref })
+ if ref($ref) eq 'HASH';
+ }
}
my ($k,$v);
while(($k,$v) = each %NetConfig) {
does not listen to port 21, then this value should be set to
C<"hostname:port"> (eg C<"hostname:99">)
+=item ftp_firewall_type
+
+There are many different ftp firewall products avaliable. But unfortunately there
+is not standard for how to traverse a firewall. The list below shows the
+sequence of commands that Net::FTP will use
+
+ user Username for remote host
+ pass Password for remote host
+ fwuser Username for firewall
+ fwpass Password for firewall
+ remote.host The hostname of the remote ftp server
+
+=over 4
+
+=item 0
+
+There is no firewall
+
+=item 1
+
+ USER user@remote.host
+ PASS pass
+
+=item 2
+
+ USER fwuser
+ PASS fwpass
+ USER user@remote.host
+ PASS pass
+
+=item 3
+
+ USER fwuser
+ PASS fwpass
+ SITE remote.site
+ USER user
+ PASS pass
+
+=item 4
+
+ USER fwuser
+ PASS fwpass
+ OPEN remote.site
+ USER user
+ PASS pass
+
+=item 5
+
+ USER user@fwuser@remote.site
+ PASS pass@fwpass
+
+=item 6
+
+ USER fwuser@remote.site
+ PASS fwpass
+ USER user
+ PASS pass
+
+=item 7
+
+ USER user@remote.host
+ PASS pass
+ AUTH fwuser
+ RESP fwpass
+
+=back
+
=item ftp_ext_passive
=item ftp_int_pasive
=back
+=for html <hr>
+
+I<$Id: //depot/libnet/Net/Config.pm#9 $>
+
=cut
@ISA = qw(Exporter);
@EXPORT_OK = qw(hostname hostdomain hostfqdn domainname);
-$VERSION = "2.13"; # $Id: //depot/libnet/Net/Domain.pm#10 $
+$VERSION = "2.14"; # $Id: //depot/libnet/Net/Domain.pm#15 $
my($host,$domain,$fqdn) = (undef,undef,undef);
return $host
if(defined $host);
- if ($^O eq 'MSWin32' || $^O eq 'cygwin') {
+ if ($^O eq 'MSWin32') {
require Socket;
my ($name,$alias,$type,$len,@addr) = gethostbyname($ENV{'COMPUTERNAME'}||'localhost');
while (@addr)
$host = "";
};
}
-
+
# remove garbage
$host =~ s/[\0\r\n]+//go;
$host =~ s/(\A\.+|\.+\Z)//go;
};
chop($dom = `domainname 2>/dev/null`)
- unless(defined $dom);
+ unless(defined $dom || $^O eq 'MSWin32');
if(defined $dom) {
my @h = ();
# Look for environment variable
- $domain ||= $ENV{LOCALDOMAIN} ||= $ENV{DOMAIN} || undef;
+ $domain ||= $ENV{LOCALDOMAIN} || $ENV{DOMAIN};
if(defined $domain) {
$domain =~ s/[\r\n\0]+//g;
# Determine from @host & @domain the FQDN
my @d = @domain;
-
+
LOOP:
while(1) {
my @h = @host;
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
+=for html <hr>
+
+I<$Id: //depot/libnet/Net/Domain.pm#15 $>
+
=cut
use Net::Config;
# use AutoLoader qw(AUTOLOAD);
-$VERSION = "2.56"; # $Id:$
+$VERSION = "2.58"; # $Id: //depot/libnet/Net/FTP.pm#57 $
@ISA = qw(Exporter Net::Cmd IO::Socket::INET);
# Someday I will "use constant", when I am not bothered to much about
$sftp->pasv_xfer($sfile,$dftp,$dfile,1);
}
+BEGIN {
+ # make a constant so code is fast'ish
+ my $is_os390 = $^O eq 'os390';
+ *trEBCDIC = sub () { $is_os390 }
+}
+
1;
# Having problems with AutoLoader
#__END__
my $io;
if($ftp->supported("SIZE")) {
return $ftp->_SIZE($file)
- ? ($ftp->message =~ /(\d+)/)[0]
+ ? ($ftp->message =~ /(\d+)$/)[0]
: undef;
}
elsif($ftp->supported("STAT")) {
send($ftp,pack("CCC", $TELNET_IAC, $TELNET_IP, $TELNET_IAC),MSG_OOB);
$ftp->command(pack("C",$TELNET_DM) . "ABOR");
-
+
${*$ftp}{'net_ftp_dataconn'}->close()
if defined ${*$ftp}{'net_ftp_dataconn'};
while(1)
{
last unless $len = $data->read($buf,$blksize);
+
+ if (trEBCDIC && $ftp->type ne 'I')
+ {
+ $buf = $ftp->toebcdic($buf);
+ $len = length($buf);
+ }
+
if($hashh) {
$count += $len;
print $hashh "#" x (int($count / $hashb));
print $hashh "\n" if $hashh;
- close($loc)
- unless defined $localfd;
-
- $data->close(); # implied $ftp->response
+ unless (defined $localfd)
+ {
+ unless (close($loc))
+ {
+ carp "Cannot close file $local (perhaps disk space) $!\n";
+ return undef;
+ }
+ }
+
+ unless ($data->close()) # implied $ftp->response
+ {
+ carp "Unable to close datastream";
+ return undef;
+ }
return $local;
}
my $ok;
return $ok
- if $ftp->_RMD( $dir ) || !$recurse;
+ if $ok = $ftp->_RMD( $dir ) or !$recurse;
# Try to delete the contents
# Get a list of all the files in the directory
return $ftp->_RMD($dir) ;
}
+sub restart
+{
+ @_ == 2 || croak 'usage: $ftp->restart( BYTE_OFFSET )';
+
+ my($ftp,$where) = @_;
+
+ ${*$ftp}{'net_ftp_rest'} = $where;
+
+ return undef;
+}
+
+
sub mkdir
{
@_ == 2 || @_ == 3 or croak 'usage: $ftp->mkdir( DIR [, RECURSE ] )';
{
my($status,$message) = ($ftp->status,$ftp->message);
my $pwd = $ftp->pwd;
-
+
if($pwd && $ftp->cwd($dir))
{
$path = $dir;
{
last unless $len = sysread($loc,$buf="",$blksize);
+ if (trEBCDIC)
+ {
+ $buf = $ftp->toascii($buf);
+ $len = length($buf);
+ }
+
if($hashh) {
$count += $len;
print $hashh "#" x (int($count / $hashb));
$sock->close() or
return undef;
- ($remote) = $ftp->message =~ /unique file name:\s*(\S*)\s*\)/
- if ('STOU' eq uc $cmd);
+ if ('STOU' eq uc $cmd and $ftp->message =~ m/unique\ file\ name:(.*)\)|"(.*)"/)
+ {
+ require File::Basename;
+ $remote = File::Basename::basename($+)
+ }
return $remote;
}
${*$ftp}{'net_ftp_listen'} ||= IO::Socket::INET->new(Listen => 5,
Proto => 'tcp',
+ Timeout => $ftp->timeout,
+ LocalAddr => $ftp->sockhost,
);
-
+
my $listen = ${*$ftp}{'net_ftp_listen'};
- my($myport, @myaddr) = ($listen->sockport, split(/\./,$ftp->sockhost));
+ my($myport, @myaddr) = ($listen->sockport, split(/\./,$listen->sockhost));
$port = join(',', @myaddr, $myport >> 8, $myport & 0xff);
$data->close();
+ if (trEBCDIC)
+ {
+ for (@$list) { $_ = $ftp->toebcdic($_) }
+ }
+
wantarray ? @{$list}
: $list;
}
return $data;
}
-
+
close(delete ${*$ftp}{'net_ftp_listen'});
-
+
return undef;
}
=head1 SYNOPSIS
use Net::FTP;
-
+
$ftp = Net::FTP->new("some.host.name", Debug => 0);
$ftp->login("anonymous",'me@here.there');
$ftp->cwd("/pub");
Returns the full pathname of the current directory.
+=item restart ( WHERE )
+
+Set the byte offset at which to begin the next data transfer. Net::FTP simply
+records this value and uses it when during the next data transfer. For this
+reason this method will not return an error, but setting it may cause
+a subsequent data transfer to fail.
+
=item rmdir ( DIR )
Remove the directory with the name C<DIR>.
the local file if it already exists.
Returns C<LOCAL_FILE>, or the generated local file name if C<LOCAL_FILE>
-is not given.
+is not given. If an error was encountered undef is returned.
=item put ( LOCAL_FILE [, REMOTE_FILE ] )
Returns the number of bytes written before any <CRLF> translation.
+=item bytes_read ()
+
+Returns the number of bytes read so far.
+
=item abort ()
Abort the current data transfer.
ftp(1), ftpd(8), RFC 959
http://www.cis.ohio-state.edu/htbin/rfc/rfc959.html
+=head1 USE EXAMPLES
+
+For an example of the use of Net::FTP see
+
+=over 4
+
+=item http://www.csh.rit.edu/~adam/Progs/autoftp-2.0.tar.gz
+
+C<autoftp> is a program that can retrieve, send, or list files via
+the FTP protocol in a non-interactive manner.
+
+=back
+
=head1 CREDITS
Henry Gabryjelski <henryg@WPI.EDU> - for the suggestion of creating directories
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
+=for html <hr>
+
+I<$Id: //depot/libnet/Net/FTP.pm#57 $>
+
=cut
-##
+## $Id: //depot/libnet/Net/FTP/A.pm#16 $
## Package to read/write on ASCII data connections
##
require Net::FTP::dataconn;
@ISA = qw(Net::FTP::dataconn);
-$VERSION = "1.13"; # $Id: //depot/libnet/Net/FTP/A.pm#9 $
+$VERSION = "1.15";
sub read {
my $data = shift;
my $size = shift || croak 'write($buf,$size,[$timeout])';
my $timeout = @_ ? shift : $data->timeout;
- $data->can_write($timeout) or
- croak "Timeout";
-
(my $tmp = substr($buf,0,$size)) =~ s/\n/\015\012/sg;
# If the remote server has closed the connection we will be signal'd
# when we write. This can happen if the disk on the remote server fills up
- local $SIG{PIPE} = 'IGNORE';
+ local $SIG{PIPE} = 'IGNORE' unless $^O eq 'MacOS';
my $len = length($tmp);
my $off = 0;
my $wrote = 0;
+ my $blksize = ${*$data}{'net_ftp_blksize'};
+
while($len) {
+ $data->can_write($timeout) or
+ croak "Timeout";
+
$off += $wrote;
- $wrote = syswrite($data, substr($tmp,$off), $len);
+ $wrote = syswrite($data, substr($tmp,$off), $len > $blksize ? $blksize : $len);
return undef
unless defined($wrote);
$len -= $wrote;
-##
+## $Id: //depot/libnet/Net/FTP/I.pm#11 $
## Package to read/write on BINARY data connections
##
require Net::FTP::dataconn;
@ISA = qw(Net::FTP::dataconn);
-$VERSION = "1.08"; # $Id: //depot/libnet/Net/FTP/I.pm#6$
+$VERSION = "1.10";
sub read {
my $data = shift;
my $size = shift || croak 'write($buf,$size,[$timeout])';
my $timeout = @_ ? shift : $data->timeout;
- $data->can_write($timeout) or
- croak "Timeout";
-
# If the remote server has closed the connection we will be signal'd
# when we write. This can happen if the disk on the remote server fills up
- local $SIG{PIPE} = 'IGNORE';
+ local $SIG{PIPE} = 'IGNORE' unless $^O eq 'MacOS';
my $sent = $size;
my $off = 0;
+ my $blksize = ${*$data}{'net_ftp_blksize'};
while($sent > 0) {
- my $n = syswrite($data, $buf, $sent,$off);
+ $data->can_write($timeout) or
+ croak "Timeout";
+
+ my $n = syswrite($data, $buf, $sent > $blksize ? $blksize : $sent ,$off);
return undef unless defined($n);
$sent -= $n;
$off += $n;
package Net::FTP::dataconn;
use Carp;
-use vars qw(@ISA $timeout);
+use vars qw(@ISA $timeout $VERSION);
use Net::Cmd;
+$VERSION = '0.10';
@ISA = qw(IO::Socket::INET);
sub reading
${*$ftp}{'net_ftp_cmd'};
}
+sub bytes_read {
+ my $ftp = shift;
+
+ ${*$ftp}{'net_ftp_bytesread'} || 0;
+}
+
1;
use Time::Local;
use Net::Config;
-$VERSION = "2.19"; # $Id: //depot/libnet/Net/NNTP.pm#8$
+$VERSION = "2.20"; # $Id: //depot/libnet/Net/NNTP.pm#13 $
@ISA = qw(Net::Cmd IO::Socket::INET);
sub new
my $c = $obj->code;
my @m = $obj->message;
-
+
unless(exists $arg{Reader} && $arg{Reader} == 0) {
# if server is INN and we have transfer rights the we are currently
# talking to innd not nnrpd
{
if(ref($spec))
{
- $arg = $spec->[0] . "-";
- $arg .= $spec->[1]
- if defined $spec->[1] && $spec->[1] > $spec->[0];
+ $arg = $spec->[0];
+ if(defined $spec->[1])
+ {
+ $arg .= "-"
+ if $spec->[1] != $spec->[0];
+ $arg .= $spec->[1]
+ if $spec->[1] > $spec->[0];
+ }
}
else
{
=head1 SYNOPSIS
use Net::NNTP;
-
+
$nntp = Net::NNTP->new("some.host.name");
$nntp->quit;
Obtain information about all the active newsgroups. The results is a reference
to a hash where the key is a group name and each value is a reference to an
-array. The elements in this array are:- the first article number in the group,
-the last article number in the group and any information flags about the group.
+array. The elements in this array are:- the last article number in the group,
+the first article number in the group and any information flags about the group.
=item newgroups ( SINCE [, DISTRIBUTIONS ])
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
+=for html <hr>
+
+I<$Id: //depot/libnet/Net/NNTP.pm#13 $>
+
=cut
use FileHandle;
use vars qw($VERSION);
-$VERSION = "2.10"; # $Id: //depot/libnet/Net/Netrc.pm#4$
+$VERSION = "2.11"; # $Id: //depot/libnet/Net/Netrc.pm#10 $
my %netrc = ();
{
my $host = shift;
my($home,$file);
-
+
if($^O eq "MacOS") {
$home = $ENV{HOME} || `pwd`;
chomp($home);
$netrc{default} = undef;
# OS/2 and Win32 do not handle stat in a way compatable with this check :-(
- unless($^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'MacOS')
+ unless($^O eq 'os2'
+ || $^O eq 'MSWin32'
+ || $^O eq 'MacOS'
+ || $^O =~ /^cygwin/)
{
my @stat = stat($file);
=head1 SYNOPSIS
use Net::Netrc;
-
+
$mach = Net::Netrc->lookup('some.machine');
$login = $mach->login;
($login, $password, $account) = $mach->lpa;
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
+=for html <hr>
+
+$Id: //depot/libnet/Net/Netrc.pm#10 $
+
=cut
use Carp;
use Net::Config;
-$VERSION = "2.21"; # $Id$
+$VERSION = "2.22"; # $Id: //depot/libnet/Net/POP3.pm#19 $
@ISA = qw(Net::Cmd IO::Socket::INET);
: "";
}
- my $md = new MD5;
+ my $md = MD5->new;
$md->add($banner,$pass);
return undef
return 0
unless($me->_RSET);
-
+
if(defined ${*$me}{'net_pop3_mail'})
{
local $_;
$me->message =~ /\d+\D+(\d+)/;
return $1 || undef;
}
-
+
my $info = $me->read_until_dot
or return undef;
($1 || 0, $2 || 0);
}
-
+
sub _STAT { shift->command('STAT')->response() == CMD_OK }
sub _LIST { shift->command('LIST',@_)->response() == CMD_OK }
sub _RETR { shift->command('RETR',$_[0])->response() == CMD_OK }
=head1 SYNOPSIS
use Net::POP3;
-
+
# Constructors
$pop = Net::POP3->new('pop3host');
$pop = Net::POP3->new('pop3host', Timeout => 60);
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
+=for html <hr>
+
+I<$Id: //depot/libnet/Net/POP3.pm#19 $>
+
=cut
+++ /dev/null
-Hopefully the next release of libnet will be release 2.00. For this
-release I want to completely re-write the configuration system.
-
-My current thoughts are that a hash of values is not sufficient and that
-Net::Config should be code. This is what I have planned, if you see any
-problems or have any ideas please let me know by sending an Email
-to gbarr@pobox.com
-
-Net::Config will become an object based interface. Methods will be called
-as static methods on the package. Net::Config will inherit from
-Net::LocalCfg and Net::Config::default. Net::LocalCfg is a package
-that local sys-admins can write to override the defaulr behaviour of
-Net::Config.
-
-Most of the variables that are currently stored in Net::Config will
-be turned into method calls, eg $NetConfig{'nntp_hosts'} will
-become Net::Config->nntp_hosts
-
-This approach will allow for a better implementation of the firewall code,
-which currently makes a lot of assumptions. To aid this Net::Config::default
-will provide a method 'reachable' which will take a single argument as
-a hostname and should return true it the host is reachable directly.
-
-This will also allow people who have dialup accounts, and appear in different
-domains at different times, to do what they need.
-
-Graham
-gbarr@pobox.com
Net::POP3 RFC1939 Post Office Protocol 3
Net::SNPP RFC1861 Simple Network Pager Protocol
-The distribution also contains a module (Net::PH) which facilitates
-comunicate with with servers using the CCSO Nameserver Server-Client
-Protocol
-
FUTURE WORK
AVAILABILITY
CONFIGURE
-Normally when perl Makefile.PL is run it will run Configure which will ask some
-questions about your system. The results of these questions will be stored in
-the Net::Config package. If you are on a system when this script cannot be run
-for some reason then the file Config.eg can be edited manually and installed
-as Net::Config (Net/Comfig.pm)
+Normally when perl Makefile.PL is run it will run Configure which will
+ask some questions about your system. The results of these questions
+will be stored in in a file called libnet.cfg which will be installed
+alongside the other perl modules in this distribution. The Makefile.PL
+will run Configure in an interactive mode unless these exists a file
+called libnet.cfg in the build directory.
+
+If you are on a system which cannot run this script you can create an
+empty file to make Makefile.PL skip running Configure. If you want to
+keep your existing settings and not run interactivly the simple run
+
+ Configure -d
+
+before running the Makefile.PL.
DOCUMENTATION
Questions about how to use this library should be directed to the
comp.lang.perl.modules USENET Newsgroup. Bug reports and suggestions
-for improvements can be sendt to me at <gbarr@pobox.com>.
+for improvements can be sent to me at <gbarr@pobox.com>.
Most of the modules in this library have an option to output a debug
transcript to STDERR. When reporting bugs/problems please, if possible,
COPYRIGHT
- © 1996-98 Graham Barr. All rights reserved.
+ © 1996-2000 Graham Barr. All rights reserved.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
use Net::Cmd;
use Net::Config;
-$VERSION = "2.15"; # $Id$
+$VERSION = "2.16"; # $Id: //depot/libnet/Net/SMTP.pm#16 $
@ISA = qw(Net::Cmd IO::Socket::INET);
my $h = ${*$me}{'net_smtp_esmtp'} = {};
my $ln;
foreach $ln (@msg) {
- $h->{$1} = $2
+ $h->{uc $1} = $2
if $ln =~ /(\S+)\b[ \t]*([^\n]*)/;
}
}
return $skip_bad ? @ok : 1;
}
-sub to { shift->recipient(@_) }
+BEGIN {
+ *to = \&recipient;
+ *cc = \&recipient;
+ *bcc = \&recipient;
+}
sub data
{
=head1 SYNOPSIS
use Net::SMTP;
-
+
# Constructors
$smtp = Net::SMTP->new('mailhost');
$smtp = Net::SMTP->new('mailhost', Timeout => 60);
This example prints the mail domain name of the SMTP server known as mailhost:
#!/usr/local/bin/perl -w
-
+
use Net::SMTP;
-
+
$smtp = Net::SMTP->new('mailhost');
print $smtp->domain,"\n";
$smtp->quit;
known as mailhost:
#!/usr/local/bin/perl -w
-
+
use Net::SMTP;
-
+
$smtp = Net::SMTP->new('mailhost');
-
+
$smtp->mail($ENV{USER});
$smtp->to('postmaster');
-
+
$smtp->data();
$smtp->datasend("To: postmaster\n");
$smtp->datasend("\n");
$smtp->datasend("A simple test message\n");
$smtp->dataend();
-
+
$smtp->quit;
=head1 CONSTRUCTOR
Debug => 1,
);
+=back
+
=head1 METHODS
Unless otherwise stated all methods return either a I<true> or I<false>
bad address is encountered and it will return an array of addresses
that did succeed.
+ $smtp->recipient($recipient1,$recipient2); # Good
+ $smtp->recipient($recipient1,$recipient2, { SkipBad => 1 }); # Good
+ $smtp->recipient("$recipient,$recipient2"); # BAD
+
=item to ( ADDRESS [, ADDRESS [...]] )
-A synonym for C<recipient>.
+=item cc ( ADDRESS [, ADDRESS [...]] )
+
+=item bcc ( ADDRESS [, ADDRESS [...]] )
+
+Synonyms for C<recipient>.
=item data ( [ DATA ] )
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
+=for html <hr>
+
+I<$Id: //depot/libnet/Net/SMTP.pm#16 $>
+
=cut
@ISA = qw(Exporter);
@EXPORT_OK = qw(inet_time inet_daytime);
-$VERSION = "2.08";
+$VERSION = "2.09"; # $Id: //depot/libnet/Net/Time.pm#9 $
$TIMEOUT = 120;
=head1 SYNOPSIS
use Net::Time qw(inet_time inet_daytime);
-
+
print inet_time(); # use default host from Net::Config
print inet_time('localhost');
print inet_time('localhost', 'tcp');
-
+
print inet_daytime(); # use default host from Net::Config
print inet_daytime('localhost');
print inet_daytime('localhost', 'tcp');
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
+=for html <hr>
+
+I<$Id: //depot/libnet/Net/Time.pm#9 $>
+
=cut
+++ /dev/null
-#!/usr/local/bin/perl
-
-use blib;
-use Getopt::Long;
-use Net::SNPP;
-
-$opt_debug = undef;
-$opt_h = undef;
-$opt_p = undef;
-
-GetOptions(qw(debug h p));
-
-die "usage: $0 -h <host> -p <pagerid> <message>"
- unless defined $opt_h && defined $opt_p && @ARGV;
-
-Net::SNPP->debug(1)
- if $opt_debug;
-
-$snpp = Net::SNPP->new($opt_host);
-
-$snpp->pager_id($opt_p) || die $snpp->message;
-$snpp->content(join(" ",@ARGV)) || die $snpp->message;
-$snpp->send() || die $snpp->message;
-
-$snpp->quit;
-
-__END__
-
-or you could dp
-
-$snpp = Net::SNPP->new($opt_host);
-
-$snpp->send( Pager => $opt_p,
- Message => join(" ",@ARGV),
- Alert => 1,
- Hold => time + 3600
- ) || die $snpp->message;
-
-$snpp->quit;
+++ /dev/null
-<SOFTPKG NAME="libnet" VERSION="1,06,0,0">
- <TITLE>libnet</TITLE>
- <ABSTRACT>Collection of Network protocol modules</ABSTRACT>
- <AUTHOR>Graham Barr <gbarr@pobox.com></AUTHOR>
- <IMPLEMENTATION>
- <DEPENDENCY NAME="IO-Socket" VERSION="1,05,0,0" />
- <DEPENDENCY NAME="Socket" VERSION="1,3,0,0" />
- <OS NAME="linux" />
- <ARCHITECTURE NAME="i586-linux" />
- <CODEBASE HREF="" />
- </IMPLEMENTATION>
-</SOFTPKG>
http://www.pobox.com/~gbarr/libnet/
-
-
=head2 How to contribute to this document
You may mail corrections, additions, and suggestions to me
gbarr@pobox.com.
-
=head1 Author and Copyright Information
Copyright (c) 1997-1998 Graham Barr. All rights reserved.
=head1 Obtaining and installing libnet
-=over 4
-
=head2 What is libnet ?
libnet is a collection of perl5 modules which all related to network
in
http://www.perl.com/CPAN/modules/by-module/Net/
-
+
The latest release and information is also avaliable on the libnet web page
at
http://www.pobox.com/~gbarr/libnet/
-=back
-
=head1 Using Net::FTP
-=over
-
=head2 How do I download files from a FTP server ?
An example taken from an article posted to comp.lang.perl.misc
sub mput {
my($ftp,$pattern) = @_;
- foreach my $file (<$pattern>) {
+ foreach my $file (glob($pattern)) {
$ftp->put($file) or warn $ftp->message;
}
}
}
-=back
-
=head1 Using Net::SMTP
-=over
-
=head2 Why can't the part of an Email address after the @ be used as the hostname ?
The part of an Email address which follows the @ is not necessarily a hostname,
This command will only fail if you pass it an address in a domain the
the server directly delivers for, and that address does not exist.
-=back
-
=head1 Debugging scripts
-=over
-
=head2 How can I debug my scripts that use Net::* modules ?
Most of the libnet client classes allow options to be passed to the
received back.
#!/your/path/to/perl
-
+
use Net::FTP;
-
+
my $ftp = new Net::FTP($host, Debug => 1);
$ftp->login('gbarr','password');
$ftp->quit;
going to the server. The remainder of the line is the command
being sent or responce being received.
-=back
-
=head1 AUTHOR AND COPYRIGHT
Copyright (c) 1997 Graham Barr.
All rights reserved.
+
+=for html <hr>
+
+I<$Id: //depot/libnet/Net/libnetFAQ.pod#4 $>
+
my $t = 1;
print "1..7\n";
-$ftp = Net::FTP->new($NetConfig{ftp_testhost}, Debug => 0)
+$ftp = Net::FTP->new($NetConfig{ftp_testhost})
or (print("not ok 1\n"), exit);
printf "ok %d\n",$t++;
}
else {
- print STDERR $ftp->message,"\n";
- printf "not ok %d\n",$t++;
- printf "not ok %d\n",$t++;
- printf "not ok %d\n",$t++;
+ print "# ",$ftp->message,"\n";
+ printf "ok %d\n",$t++;
+ printf "ok %d\n",$t++;
+ printf "ok %d\n",$t++;
}
$ftp->quit or do {