in reply to Re: Uninitialized value in Net::FTP I.pm
in thread Uninitialized value in Net::FTP I.pm

Sorry for being non specific. In the meantime I have
created a simplified version of the script that
produces the same error. Here it goes:

#!/app/ecb/perl/bin/perl -w use Net::FTP; $FTP_HOST="machine"; $FTP_USER="ftp"; $FTP_PASSWORD="ftp"; $FTP_SRC_FILENAME="pub/src_file"; $FTP_DST_FILENAME="./results"; $ftp= new Net::FTP( ${FTP_HOST} ); $ftp->login( ${FTP_USER}, ${FTP_PASSWORD} ); $ftp->binary; $ftp->get( ${FTP_SRC_FILENAME}, ${FTP_DST_FILENAME}); $ftp->quit; # End of script
Machine that I'm ftping from:
SunOS 4.1.3_U1 1 sun4m

Machine to which transfer goes:
SunOS 5.7 Generic_111437-01 sun4u sparc SUNW,UltraSPARC-IIi-cEngine

And yes, I.pm handles binary transfers. Actually exactly
the same error occurs for ascii transfers, but in A.pm.
The line at which it fails in both cases reads:
$blksize = $size if $size > $blksize;

And the perl version (from perl -V) is:
perl5 (revision 5.0 version 6 subversion 0)

The result files are perfect.

topsik

Replies are listed 'Best First'.
Re: Re: Re: Uninitialized value in Net::FTP I.pm
by cfreak (Chaplain) on Sep 25, 2001 at 20:47 UTC
    You are using the -w switch after your #! line which turns warnings on. The error message you are getting is just a warning rather than being something fatal (which is why your files are still being transfered).

    If you don't want to see it the fastest and easiest thing is to just remove the -w. I don't know of anyway to leave warnings on and not get them for the Net::Ftp module.
Re: Re: Re: Uninitialized value in Net::FTP I.pm
by runrig (Abbot) on Sep 25, 2001 at 21:06 UTC
    I don't know what could be happening. Either size or blksize is undefined (if your line number is correct), and coming into the subroutine there's this line:
    my $size = shift || croak 'read($buf,$size,[$timeout])';
    So the script should die if size is undefined, and blksize is set when you create the ftp object, and you don't seem to be changing blksize anywhere. What version of Net::FTP do you have? Though it seems unnecessary on such a short script, my only advice is use strict and warnings, at least on the larger script this script comes from, and maybe step through with the perl perldebugger.