[San-Diego-pm] A few questions of Perl

Keith Thompson kst at mib.org
Wed Dec 9 18:21:13 PST 2009


On Wed, Dec 09, 2009 at 05:49:10PM -0800, Christopher Hart wrote:
> 1. I would assume, (possibly incorrectly) that using the Socket or
> IO::Socket modules would provide the inherent ability to open more than one
> tcp socket for send/receive. Although i could see being limited in having
> more than one [socket bound to a] filehandle open, there are always a
> billion ways to do something in perl.

I lack sufficient expertise to comment on this, but ...

> 2. I've seen someone do a sleep(undef, undef, undef, 0.2); to wait a
> quarter-second, but i can't confirm it works.

It's select(undef, undef, undef, 0.25).  "perldoc -f select" for
more information (you'll need to scroll past the "select FILEHANDLE"
version).

But I'm not sure that that's what Alex is looking for.  He wrote:

    2. Is there a event scheduler modules I can use to schedule the sending of
    a message say several milisecond in the future.

which suggests he wants schedule the event to take place in the future,
and continue doing other stuff until it triggers.

Time:HiRes::ualarm lets you schedule a SIGALRM signal to be delivered
after a specified time.

-- 
Keith Thompson (The_Other_Keith) kst at mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"


More information about the San-Diego-pm mailing list