Dear Perl Monks,

I am writing a long running perl script that connects to a NNTP server and fetches some articles, decodes the binaries, then fetch some more articles. Everything works fine, but sometimes the NNTP server disconnects me because the decode process takes too long. I want to have a way to test whether the connection is still there or have I timed out.

There needs to be a method that will return true if we are still connnected, and false otherwise. Much like DBI's ping method to test if we are still connected to the database. How would I go about doing this? Of course, there is the easy solution; just re-connect everytime I need to fetch articles. I would like your thoughts.

Btw, I am using Net::NNTP, and I have poked around in the source to see if there's any undocumented methods I can call. But it's all very ugly and I have not found anything that helps.


In reply to Net::NNTP ping? by akis

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.