2022-6-9 1:26 Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> wrote: > > > 3) use a new variable that holds the exception object and populate $@ > > with its string representation? > > This might actually be a thing. > > We can't change the existing behaviour of $@, but we *could* create > some other variable, say, ${^EXCEPTION}, that would receive these new > objects, and say that actually the catch var uses that instead: > > try { ... } > catch($e) { > if($e isa X::Perl::ENOENT) { ... } > } > > These objects could then have whatever new interface we decided. > > If the user is still using "legacy" eval-and-$@ then they'll receive a > stringified version of the object in that case, so as to not break > legacy behaviour. > > I feel good. try - catch is yet experimental. In the only case of try - catch (remaining of the behavior eval {}; if ($@) { } ), the content of "$e" can be changed.Thread Previous | Thread Next