My first thought is that it doesn't retrieve the details needed from the database quick enough to create the IO::Socket::Inet connection.
Without further explanation, that statement doesn't appear to make much sense. There is no way to arrive at the line that (attempts to) open the socket, before the preceding statements that provide the information to make that connection have completed.
What does make sense is that the attempt to create the socket connection is failing for some reason, thus when you get to the erring line, $dusky is still undefined.
The appropriate course of action would be to add error checking to the socket creation:
my $dusky = IO::Socket::INET->new( PeerAddr => $duskyip, PeerPort =>$duskymoxaport, Proto => 'tcp', T +imeout => 1 ) or warn "Connection to $duskyip:$duskymoxaport failed because $!/$^E +" and next XXX;
That would probably give you a good clue as to why the connection is failing (and is good practice anyway!).
A likely candidate for the failure is that your 1 second timeout sometimes isn't enough when you've just opened connections to 30-odd previous machines and the network/stack is very busy. You might just need to extend the timeout; or perhaps add a retry loop.
In reply to Re: Fast database access using DBM::Deep help
by BrowserUk
in thread Fast database access using DBM::Deep help
by Doozer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |