Keep It Simple, Stupid | |
PerlMonks |
can't assign signal handler an undef valueby papidave (Pilgrim) |
on Dec 21, 2007 at 22:38 UTC ( [id://658559]=perlquestion: print w/replies, xml ) | Need Help?? |
papidave has asked for the wisdom of the Perl Monks concerning the following question:
Ok, this one has me entirely confused. Although I have a workaround (see below), the reason I even need a workaround escapes me. The requirement is to be able to allow users to interrupt a certain operation (Ctrl-C) which may be called from an application that has $SIG{INT} set to 'IGNORE'. The initial code for this (Perl 5.8.8, Linux) was:
What I found was that the code worked properly when $SIG{INT} had been blocked, but if called from code that did not alter $SIG{INT}, I got slammed with a "Use of uninitialized value in scalar assignment" warning. Since I want my code to run clean, I did some investigation. First, the key INT exists, and has an undefined value. But I get the warning when I try to assign an undefined value back into the hash. I can avoid the assignment by using a local $SIG{INT}, e.g.:
... but this seems entirely bogus. Can someone suggest a good reason why %SIG would be initialized with values that I can't assign to it? I don't get this warning when I do a simple "$foo{INT} = undef;"
Back to
Seekers of Perl Wisdom
|
|