in reply to Causing discord between Net::FTP and IO::Sockets

Net::FTP::A is a child of Net::FTP::dataconn and dataconn is a child of IO::Socket::INET and IO::Socket::INET has method new. I actually don't understand why I got these results:

perl -MNet::FTP::A -e 'print Net::FTP::A->can("new") || "can not", "\n +"' can not
but
perl -MNet::FTP::A -MIO::Socket::INET -e 'print Net::FTP::A->can("new" +) || "can not", "\n"' CODE(0x10f3d70)

Update: it looks like a problem in Net::FTP::dataconn. It contains @ISA = qw(IO::Socket::INET), but there's no require IO::Socket::INET

Update2: you can add use IO::Socket::INET into your programm to fix the problem

Replies are listed 'Best First'.
Re^2: Causing discord between Net::FTP and IO::Sockets
by Cefu (Beadle) on Jan 27, 2009 at 19:12 UTC

    zwon,

    Thanks for helping me think around this problem. I looked at all the @ISA = statements and require statements and saw exactly what you described.

    Adding use IO::Socket::INET; to my code did not fix the problem but fortunately I had already stumbled across the answer.

    In trying to execute your quick check on my platform I accidentally typed in the following:

    perl -MNet::FTP -MIO::Socket::INET -e 'print Net::FTP::A->can("new") || "can not", "\n"'

    and was surprised to get the answer

    can not

    Notice that I had omitted the ::A in the first -M switch. When I corrected the check to be exactly as you typed it, I got the expected result. Adding use IO::Socket::INET; to the existing code made it just like the mistyped check. That is, using the packages Net::FTP and IO::Socket::INET but not explicitly using Net::FTP::A.

    So, by adding the two lines:

    use Net::FTP::A; use IO::Socket::INET;
    to my code I avoided the runtime error.


    Thanks,
    Cefu

    P.S. I'm still confused as to why something I'm doing during processing could selectively trigger this behavior. Is this a bug that I should report to the Net::FTP author or am I doing something extraordinary to trigger this condition?

      It would be great if you show how to reproduce problem. Then I think it would be clear if it's a bug in Net::FTP or in your code.