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

Hi, I'm using Net::FTP to copy files across and getting an error (multiple times): Use of uninitialized value in numeric gt (>) at /app/ecb/perl/lib/site_perl/5.6.0/Net/FTP/I.pm line 26. Files get copied OK though. Can anyone please tell me why this is happening and how to get rid of it? Thanx topsik

Replies are listed 'Best First'.
Re: Uninitialized value in Net::FTP I.pm
by idnopheq (Chaplain) on Sep 25, 2001 at 14:45 UTC
    Can you post your code, please. It becomes infinitely difficult for us to help you w/o knowing how you are using Net::FTP. Also, can you fill us in more on the environment you are ftp-ing from? When the "Files get copied OK", I take it that they are not corrupted and the line endings are correct ( I believe the I.pm module handles binary transfers )?

    HTH
    --
    idnopheq
    Apply yourself to new problems without preparation, develop confidence in your ability to to meet situations as they arrise.

      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
        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.
        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.