Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I cant get my ftp to work. I keep getting error message such as:

C:\Perl\bin>ftpr.pl
Can't call method "login" on an undefined value at C:\Perl\bin\ftpr.pl line 5. The script:
use Net::FTP; $ftp = Net::FTP->new("myserver@here.com", Debug => 0); $ftp->login("myname","mypassword") || die "Did not work:$!\n"; $ftp->cwd("/usr/home/myname"); $ftp->get("test.txt"); $ftp->quit;
The server I am trying to get the file from is behind a firewall. I am on a NT workstation trying to get a file off a Solaris 7 server.

Replies are listed 'Best First'.
Re: ftp attempt
by gav^ (Curate) on Sep 10, 2002 at 12:06 UTC
    The docs mention:
    If the constructor fails undef will be returned and an error message will be in $@
    If you change your code to:
    $ftp = Net::FTP->new("myserver@here.com", Debug => 1) || die "Unable to connect: $@\n";
    Hopefully the error message will help.

    gav^

Re: ftp attempt
by helgi (Hermit) on Sep 10, 2002 at 12:59 UTC
    gav^++ on suggesting you add the Debug info.

    Also, your server name, myserver@here.com looks more like an e-mail address than a server. I am pretty sure it should be myserver.here.com

    Regards,
    Helgi Briem