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

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",'') 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"; }


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://166905]
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
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (68 votes). Check out past polls.