Very cool. Thank you!
I did notice that the docs for Fatal are somewhat off when they say that overridable built-ins can be modified through this module. In fact Fatal can handle only those overridable built-ins foo such that prototype('foo') is defined; there are overridable built-ins for which this is not the case, and therefore will cause Fatal to fail at compile time.
For instance:
butuse strict; use Fatal 'chop'; # My name's Bond, James Bond. chop 'Ow!'; __END__ Cannot make a non-overridable builtin fatal at /opt/perl-5.8.4/lib/5.8 +.4/Fatal.pm line 108. BEGIN failed--compilation aborted at testfatal.pl line 2.
use strict; use subs 'chop'; sub chop { print "hello from chop\n"; } chop 'Ow!'; __END__ hello from chop
Here's the relevant part of Fatal.pm
$proto = eval { prototype "CORE::$name" }; # ... die "Cannot make a non-overridable builtin fatal" if not defined $proto;
the lowliest monk
In reply to Re^2: wishlist: die-on-failure for built-ins
by tlm
in thread wishlist: die-on-failure for built-ins
by tlm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |