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.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: Fast database access using DBM::Deep help by BrowserUk
in thread Fast database access using DBM::Deep help by Doozer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.