Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

$SIG{ALRM} timeout and Win32::DDE::Client hangs?

by TedPride (Priest)
on Nov 05, 2007 at 23:45 UTC ( #649115=perlquestion: print w/ replies, xml ) Need Help??
TedPride has asked for the wisdom of the Perl Monks concerning the following question:

eval { local $SIG{ALRM} = sub { die "Unable to initiate Zip4 connection"; + }; alarm(1); $zip4 = new Win32::DDE::Client('ZP4', 'Addresses'); $SIG{ALRM}->() if $zip4->Error; alarm(0); }; die $@ if $@;
This works just fine when I replace the $zip4 parts of the code with something else, like say sleep(10). However, if the ZP4 application doesn't happen to be running already and ready for connections, it just sits there and hangs rather than dying after 1 second like it's supposed to. Why?

Comment on $SIG{ALRM} timeout and Win32::DDE::Client hangs?
Download Code
Re: $SIG{ALRM} timeout and Win32::DDE::Client hangs?
by erroneousBollock (Curate) on Nov 06, 2007 at 01:00 UTC
    Signals (in perl) are a hack on Win32, you can't expect them to be delivered to (and understood by) non-perl Win32 software like the "ZP4" application (whatever that is).

    -David

Re: $SIG{ALRM} timeout and Win32::DDE::Client hangs?
by BrowserUk (Pope) on Nov 06, 2007 at 01:36 UTC

    See the POD:

    Timeout (NEWVALUE)

    If NEWVALUE is present, set the timeout value (in milliseconds) used for DDE operations; return the old value.

    The timeout value is initially set to $Win32::DDE::Client::Timeout when the object is constructed. $Win32::DDE::Client::Timeout is set to 1000 when the module is loaded.


    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://649115]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-10-24 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (131 votes), past polls