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

Re^2: email address as username

by nateh (Initiate)
on Oct 17, 2018 at 18:55 UTC ( #1224176=note: print w/replies, xml ) Need Help??


in reply to Re: email address as username
in thread email address as username

If I use single quotes, I get the error "Can't call method "login" on an undefined value at line x." Here's the relevant portion of the code:
use Net::FTP; my ($ftp, $host, $user, $pass, $dir, $fpath); $host = 'ftp.my.com'; $user = 'last.first@somewhere.com'; $pass = 'mypass'; $dir = '/my/file_path/onftp'; $fpath = 'myfileonserver_xml.zip'; $ftp = Net::FTP->new($host, Debug => 0); $ftp->login($user, $pass) || die $ftp->message; ##this is line x## $ftp->cwd($dir); $ftp->put($fpath) || die $ftp->message; $ftp->quit;

Replies are listed 'Best First'.
Re^3: email address as username
by Marshall (Canon) on Oct 17, 2018 at 21:23 UTC
    From the Net::FTP docs:
    $ftp = Net::FTP->new("some.host.name", Debug => 0) or die "Cannot connect to some.host.name: $@";
    Check for errors as shown in the docs. What does that say?
Re^3: email address as username
by poj (Abbot) on Oct 17, 2018 at 19:02 UTC

    You are missing a semi-colon from the end of this line.

    use Net::FTP
    poj

      Yes it was in my code correct with the ";". It was just a typo on my post.

Re^3: email address as username
by Happy-the-monk (Canon) on Oct 17, 2018 at 19:23 UTC

    You are getting the error on your first use of the $ftp object.

    That means the construction of it in the line above failed, where you specified $ftp = Net::FTP->new($host, Debug => 0);

    I can't see from here why it failed, you will have to debug if you can reach $host using some other method to ftp for instance.

    Cheers, Sören

    Créateur des bugs mobiles - let loose once, run everywhere.
    (hooked on the Perl Programming language)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2022-01-29 08:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (74 votes). Check out past polls.

    Notices?