diff options
author | Graham Barr <gbarr@pobox.com> | 2002-07-15 23:28:02 +0000 |
---|---|---|
committer | Graham Barr <gbarr@pobox.com> | 2002-07-15 23:28:02 +0000 |
commit | 35c22630c70514f10b5a5236b8cf9bc8620601d2 (patch) | |
tree | c8961f53155a101ecb005824e64fcd14835aa8ab | |
parent | 5ee520b4c67ac7092729ae3e7d69f7c166ddf6a7 (diff) | |
download | perl-libnet-35c22630c70514f10b5a5236b8cf9bc8620601d2.tar.gz |
Net::FTP
- Allow the user to specify a local address to use for sockets
-rw-r--r-- | Net/FTP.pm | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -22,7 +22,7 @@ use Net::Config; use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC); # use AutoLoader qw(AUTOLOAD); -$VERSION = "2.65"; # $Id: //depot/libnet/Net/FTP.pm#68 $ +$VERSION = "2.66"; # $Id: //depot/libnet/Net/FTP.pm#69 $ @ISA = qw(Exporter Net::Cmd IO::Socket::INET); # Someday I will "use constant", when I am not bothered to much about @@ -76,6 +76,7 @@ sub new my $ftp = $pkg->SUPER::new(PeerAddr => $peer, PeerPort => $arg{Port} || 'ftp(21)', + LocalAddr => $arg{'LocalAddr'}, Proto => 'tcp', Timeout => defined $arg{Timeout} ? $arg{Timeout} @@ -86,6 +87,8 @@ sub new ${*$ftp}{'net_ftp_type'} = 'A'; # ASCII/binary/etc mode ${*$ftp}{'net_ftp_blksize'} = abs($arg{'BlockSize'} || 10240); + ${*$ftp}{'net_ftp_localaddr'} = $arg{'LocalAddr'}; + ${*$ftp}{'net_ftp_firewall'} = $fire if(defined $fire); ${*$ftp}{'net_ftp_firewall_type'} = $fire_type @@ -908,6 +911,7 @@ sub _dataconn $data = $pkg->new(PeerAddr => join(".",@port[0..3]), PeerPort => $port[4] * 256 + $port[5], + LocalAddr => ${*$ftp}{'net_ftp_localaddr'}, Proto => 'tcp' ); } @@ -1277,6 +1281,9 @@ simply invokes the C<hash()> method for you, so that hash marks are displayed for all transfers. You can, of course, call C<hash()> explicitly whenever you'd like. +B<LocalAddr> - Local address to use for all socket connections, this +argument will be passed to L<IO::Socket::INET> + If the constructor fails undef will be returned and an error message will be in $@ @@ -1710,6 +1717,6 @@ under the same terms as Perl itself. =for html <hr> -I<$Id: //depot/libnet/Net/FTP.pm#68 $> +I<$Id: //depot/libnet/Net/FTP.pm#69 $> =cut |