For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > September 2006 > can't locate method new IO::Socket::INET









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author can't locate method new IO::Socket::INET
ten8ciousb

2006-09-28, 6:59 pm

Sometimes, not always, an attempt to create a new socket connection
fails with this message:
Socket::INET" (perhaps you forgot to load "IO::Socket::INET"?) at
/usr/local/lib/perl5/5.6.1/IO/Socket/INET.pm line 32

Any ideas why or how INET.pm fails saying it can't find new in INET.pm?
The script runs on many servers many times a day, but only fails on one
and generally about the same time of the day. Okay. Seems kind of
obvious that is something specific to the server and the time of day.
But, within the same script there are multiple calls to create sockets
to different servers and they complete successfully.

I'm kind of out of my element on the internals of perl here, but my
thoughts:
Is it trying to find IO::Socket::INET.pm in @INC in order to identify
the super class, which is IO::Socket?
Does that mean that @INC has somehow become 'corrupted' during runtime?

any other thoughts.
Or has perl's symbol table become corrupted so it doesn't know what
"new" is?


nothing fancy in the script:

use IO::Socket;
use IO::Socket::INET;

$sock = IO::Socket::INET->new(
PeerAddr => $host,
PeerPort => $port,
Proto => 'tcp',
);

for reference : in INET.pm:
@ISA = qw(IO::Socket);
....
sub new {
my $class = shift;
unshift(@_, "PeerAddr") if @_ == 1;
return $class->SUPER::new(@_); ### Here's line 32

}

Sisyphus

2006-09-29, 3:59 am


"ten8ciousb" <brent.honadel@lawson.com> wrote in message
..
..
>
> use IO::Socket;
> use IO::Socket::INET;
>
> $sock = IO::Socket::INET->new(
> PeerAddr => $host,
> PeerPort => $port,
> Proto => 'tcp',
> );
>


Pretty much stumped by this. (The *full* error message as a copy'n'paste
could be helpful as that would remove *all* guesswork on our part.)

Normally you don't 'use IO::Socket::INET;' - you just 'use IO::Socket;'. I
can't think of why that would stuff things up, but it's a change you could
try.

Cheers,
Rob


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com