Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: net::ftp please

by Adam (Vicar)
on Apr 18, 2001 at 04:46 UTC ( #73403=note: print w/replies, xml ) Need Help??


in reply to net::ftp please

Net::FTP is actually part of the libnet distribution. The module is actually pretty solid, except that you have to check the return codes after every call. (I'm not a real fan of that style of code.) This is done by calling $ftp->ok() after every other $ftp call. The actual message is in two parts, code() and message(). So you end up doing:
use strict; use Net::FTP; my $ftpSite = "ftp.somesite.net"; my $username = "..."; my $password = "..."; my $ftp = Net::FTP->new( $ftpSite ) or die "No connect to '$ftpSite' : $@"; $ftp->login( $username, $password ); die $ftp->code(), ": ", $ftp->message() unless $ftp->ok(); # and so on...
I usually write a status method that retrieves and prints the status messages regardless of any errors, and then hiccups when not $ftp->ok(). So my code reads $ftp->func(); check( $ftp ); over and over again. But the end result is well worth it.

I hope that helps.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://73403]
help
Chatterbox?
[talexb]: Wow, what hilariously bad form.
[SuicideJunkie]: Just wait; someday soon, you'll be given a DB with unicode emojis in the column names.
[Corion]: marinersk: Well, I have done select statements like select sum(foo) as "Total Amount", ..., but to have a table like that makes me shudder
[Corion]: SuicideJunkie: :-D
[marinersk]: SuicideJunkie LOL
[choroba]: Woohoo! Fixed a test that hasn't run for 3 years.
[marinersk]: Corion Yes, sometimes whitespace in column headers is acceptable, but I still consider it be less than desireable if that query might get revectored for an ETL-esque process...
[marinersk]: choroba++
[choroba]: it's a long running test, so it's normally skipped unless an env var is set

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2017-05-25 15:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?