laziness, impatience, and hubris | |
PerlMonks |
How can I catch accesses to undefined variables/functions/methods?by faq_monk (Initiate) |
on Oct 08, 1999 at 00:27 UTC ( [id://701]=perlfaq nodetype: print w/replies, xml ) | Need Help?? |
Current Perl documentation can be found at perldoc.perl.org. Here is our local, out-dated (pre-5.6) version: The AUTOLOAD method, discussed in Autoloading and AUTOLOAD: Proxy Methods, lets you capture calls to undefined functions and methods.
When it comes to undefined variables that would trigger a warning under
$SIG{__WARN__} = sub {
for ( $_[0] ) { # voici un switch statement
/Use of uninitialized value/ && do { # promote warning to a fatal die $_; };
# other warning cases to catch could go here;
warn $_; }
};
|
|