My chosen quest is to extend Srinivasn's Msg.pm (Advanced Perl Programming, Rel 1) by adding a 'workproc' capability. A callback that is called when the TIMEOUT in a select expires. That term came from X11. I used these a lot in X11R3 days.
I start by looking up Perl's handling of a TIMEOUT by IO:Select :
perldoc IO::Socket says
"TIMEOUT" is optional and has the same effect as for the core select call.
Rather terse and not of much help. This will not be a trivial quest! Me thinks there will be much testing and gnashing of teeth.
"core select call"... can't mean the Perl 'select' of the default FILE handle to print to. But perldoc -f select shows a more promising overloading of select! The documentation on the format of the TIMEOUT argument and response to it expiring are:
perldoc -f select says
The timeout, if specified, is in seconds, which may be fractional.
...
On error, "select" behaves like the select(2) system call : it
returns -1 and sets $!.
Is a timeout treated as an error? Questing on leading to
man 2 select says
return the number of file descriptors contained in the three returned descriptor sets (that is, the
total number of bits that are set in readfds, writefds, exceptfds)
which may be zero if the timeout expires before anything interesting
happens.
...
On error, -1 is returned, and errno is set appropriately; the
sets and timeout become undefined, so do not rely on their contents
after an error.
Gashing of teeth begins quickly...
- Is the timeout an error or a success?
- IO:Select return a list of refs($rset, $wset); core select returns a scalar $nfound.
- Are either of $! or $@ set to anything interesting, like 'timeout', upon a timeout?
- Are the returned IO:Select refs always undef or always empty in the case of a timeout? Or sometimes contain set bits as well?
It is always better to have seen your target for yourself, rather than depend upon someone else's description.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.