From: Peter Bevan [mailto:[EMAIL PROTECTED]]
<snip>
>Error handling should be supported by it's own keyword i.e.:
>
>trap {
> #CODE
>}
>release (error) {
> # ERROR
>}
</snip>
I think this is touched on by RFC# 3 wherein I ask for user definable error
messages. With those one could presumably set an error or warning's
handler (I suggested a callback interface) to undef to ignore that error or
warning.
What I was suggesting was somthing like:
$PERL_CORE{DIE} => undef;
die 'you can't kill me!'; # is ignored
{
$PERL_CORE{DIE} = { fatal => 0 }
die 'just a warning!'; # just produces a warning
}
die 'I\'m not dead yet!'; # back to ignoring die
$PERL_CORE{DIE} = { fatal => 'tiz true' };
die 'OK, OK, already, I'm dead'; # terminates program using CORE::die
# and prints "OK, OK, already, I'm dead"
$PERL_CORE{DIE} = { fatal => 1, sub { CORE::die q(Bring out yer dead!) } }
die 'OK, OK, already, I'm dead'; # terminates program using
# $PERL_CORE{DIE}->{handler}->()
# so it prints "Bring out yer dead!"
Not knowing much about perl internals, my propostal is quite vague, but am I
correct in assuming that what your asking for is the same, namely executing
a custom code block when a known error (and perhaps warning) is encoutered
at runtime?
As for implementation (ie:
$PERL_CORE{SOME_ERROR}
vs
trap { ... } release () { ... }
) I'm not opposed to either, but I think a few others should weigh in, then
maybe an RFC. Also I kind of like
catch / release
for amusement value.
-Corwin