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

Hello Perlmonks,

I get the message:

Can't use an undefined value as a symbol reference at /usr/share/perl/5.10/Net/FTP/dataconn.pm line 54.

in using Nett::Ftp .

There is a special feature which is other at one customer as at the others. This one needs - so it does seem - Passive mode, the others don't. The difference is the following:

Normaly I call

$ftp = Net::FTP->new($server) or die "Cannot connect to $server: $@";

In the case of this single customer I call

$ftp = Net::FTP->new($server, Passive => 1) or die "Cannot connect to $server (Passive=$passiv +e): $@";

But as you might see, this is not the point of the error because it does not give the message of the die.

Do anyone has any idea what could be wrong?

thanks in forehand and regards, Thomas

Replies are listed 'Best First'.
Re: "Can't use an undefined value as a symbol reference" in using Net::Ftp
by Corion (Patriarch) on Aug 09, 2013 at 13:42 UTC

    What is the relevant code that reproduces the error?

    Most likely, the simple creation of the Net::FTP object does not lead to the error immediately.

    Please find out what other steps are necessary to reproduce the problem.

      Thanks so far. The following code is the one that is the relevant part. All this together is surrounded by an eval

      if ($server =~ m/(conopera|176.98.166.98)/i) { # fies, n +ame wurde in IP geaendert $passive = 1; $ftp = Net::FTP->new($server, Passive => 1) or die "Cannot connect to $server (Passive=$passiv +e): $@"; } else { $ftp = Net::FTP->new($server) or die "Cannot connect to $server: $@"; } $ftp->login($login, $passwd) or die "Cannot login (Passive=$passive) ", $ftp->m +essage; $ftp->cwd($remotedir) or die "Cannot change working directory (Passive=$ +passive) ", $ftp->message; $ftp->binary or die "Cannot change to binary mode (Passive=$pas +sive) ", $ftp->message; $ftp->put($localfilename, $remotefilename) or die "put failed (Passive=$passive) ", $ftp->mes +sage, "; localfilename: [$localfilename], remotefilename: [$remotefil +ename]"; $ftp->quit;

      thanks in forehand, Thomas

        This seems to be similar to bugs RT #48260 and RT #37700. This should be fixed by with 1.22_02 maybe.