Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks,
I accidentally tried to assign a non-existing function to $SIG{__DIE__}. It took some time to find that bug, because perl did not emit any warnings or errors.
My code, stripped down to show the problem:
#!/usr/bin/perl -T -w use strict; use warnings; $SIG{'__DIE__'}=\&noSuchFunction; print "You should not see this text\n"; # but you will!
Is it a bug in perl (v5.8.8)? I think I should not be able to create and assign a reference to a non-existing function, at least not with strict and warnings enabled.
Using 'noSuchFunction' instead of \&noSuchFunction did not help (and is not recommended in perlvar.pod), only *noSuchFunction generated a warning.
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reference to non-existing function without warning or error
by ikegami (Patriarch) on Aug 02, 2007 at 15:09 UTC | |
by Anonymous Monk on Aug 03, 2007 at 20:04 UTC |