Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: ftp return value

by derby (Abbot)
on May 16, 2002 at 02:22 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-25 05:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found