Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: ftp return value

by derby (Abbot)
on May 16, 2002 at 02:22 UTC ( #166905=note: print w/replies, xml ) Need Help??


in reply to ftp return value

Raj, Check out the Net::FTP documentation. Most ftp methods return undef on failure. So check after each operation. Wraping in eval will also help.

eval { $ftp = Net::FTP->new("mysys",Port => 9021, Timeout => 20, Debug => 0) or die "Cannot create ftp object"; $ftp->login("anonymous",'me@myself.com') or die "Cannot login"; $ftp->put("$dir/$file1") or die "Cannot put"; $ftp->put("$dir/$file2") or die "Cannot put"; $ftp->put("$dir/$file3") or die "Cannot put"; $ftp->quit; } if( $@ ) { print "We had an issue: ", $@, "\n"; } else { print "A-Okay"; }

I don't see an mput type method, but it should be real trivial to code:

@files = qw( $file1 $file2 $file3 ); foreach( @files ) { $ftp->put( $_ ) or die "Cannot put"; }

-derby

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://166905]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (1)
As of 2022-05-18 04:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (68 votes). Check out past polls.

    Notices?