go ahead... be a heretic | |
PerlMonks |
Causing discord between Net::FTP and IO::Socketsby Cefu (Beadle) |
on Jan 26, 2009 at 21:00 UTC ( [id://739030]=perlquestion: print w/replies, xml ) | Need Help?? |
Cefu has asked for the wisdom of the Perl Monks concerning the following question: Fellow Monks, It seems the rumors my code is spreading about Net::FTP are souring it's relationship with IO::Sockets. I'm receiving the following error at the end of one of my modules:
I searched for this problem and found several posts (2 from PerlMonks even) about very similar errors; in each case the answer was a missing or incorrectly installed Net::FTP package. I'm almost certain this is not my issue as I have two very similar programs, one of which gets this error and the other does not (running on the same machine invoking the same version of PERL from the same user account etc. etc.). Both programs do some electronic polling of devices, collate some data, save it to a file then FTP that file to the reports server. The following code is common to both programs:
Not suspecting anything in the code above (remember, the other program works flawlessly) I moved on to the Sockets.pm line listed in the error message. The following code is from the Sockets.pm (version 1.29 if that helps) which my program seems to be invoking. The snippet ends with the problem-child, line 168:
So it seems that Socket.pm assumes that the Package referenced in $pkg has a 'new' method. I don't know what is passed when sub_accept is called nor do I understand exactly how the code above pulls that into $pkg. I would guess that in the normal course of things $pkg references Net::FTP and the resulting Net::FTP->new() is fine. In my case, however, it seems that $pkg must contain a reference to Net::FTP::A for some reason. I've looked into Net/FTP/A.pm and it indeed does not (nor was it intended to) have a 'new' method. As I said one program gets the error while the other, differing only in the polling/processing which I skipped above, does not. Following this lead I fed the first program bogus input such that it never did any real processing and found that it could run error-free (successfully FTPing a small file) as well. So it seems that something I do during processing screws up what gets into Socket.pm's $pkg variable and breaks the wonderful, trusting relationship these two packages normally have. Anyone have an idea what I could be doing to muck things up here? Thanks, Disclaimer: Please don't nitpick the code above; It was hand-typed. The system I'm coding on is specifically (and strictly) isolated from the internet so cut-and-paste is not an option. If it's not potentially the source of my problem then it's probably a typo and I apologize. I can't reproduce the processing portion of the script verbatim here. If someone has a guess what I might be doing I can look for it in the processing and post some look-alike code.
Back to
Seekers of Perl Wisdom
|
|