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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.