diff options
author | Graham Barr <gbarr@pobox.com> | 1998-02-21 17:28:11 +0000 |
---|---|---|
committer | Graham Barr <gbarr@pobox.com> | 1998-02-21 17:28:11 +0000 |
commit | 93fc2ae682de13eedd29471d0e3f20d01d182647 (patch) | |
tree | 6ba5cb7f387c8c5ff7cae1b4034b0628cb4d3a18 | |
parent | 8241b33195f293301f9a30cdc9778d5abfbcea0e (diff) | |
download | perl-libnet-93fc2ae682de13eedd29471d0e3f20d01d182647.tar.gz |
Net::FTP
- Changes to mkdir for recursive creates.
-rw-r--r-- | Net/FTP.pm | 27 |
1 files changed, 22 insertions, 5 deletions
@@ -21,7 +21,7 @@ use Net::Cmd; use Net::Config; # use AutoLoader qw(AUTOLOAD); -$VERSION = "2.36"; # $Id: //depot/libnet/Net/FTP.pm#20 $ +$VERSION = "2.37"; # $Id: //depot/libnet/Net/FTP.pm#21 $ @ISA = qw(Exporter Net::Cmd IO::Socket::INET); # Someday I will "use constant", when I am not bothered to much about @@ -420,15 +420,32 @@ sub mkdir $path .= shift @path; $ftp->_MKD($path); + $path = $ftp->_extract_path($path); + } + + # If the creation of the last element was not sucessful, see if we + # can cd to it, if so then return path - # 521 means directory already exists - last - unless $ftp->ok || $ftp->code == 521 || $ftp->code == 550; + unless($ftp->ok) + { + my($status,$message) = ($ftp->status,$ftp->message); + my $pwd = $ftp->pwd; + + if($pwd && $ftp->cd($dir)) + { + $path = $dir; + $ftp->cd($pwd); + } + else + { + undef $path; + } + $ftp->set_status($status,$message); } } - $ftp->_extract_path($path); + $path; } sub delete |