Open KES777 opened 8 years ago
Error is clobbered before we process it
Arguments to functions are just aliases. When we process error we should copy $@ as soon as possible. When we pass $@ as argument we may implicitly loose its value
sub test { $@ = 'Oops'; my( $x ) = @_; print $x; # Oops } $@ = 'Exception'; test( $@ );
Summary
Error is clobbered before we process it
Motivation
Arguments to functions are just aliases. When we process error we should copy $@ as soon as possible. When we pass $@ as argument we may implicitly loose its value
References
sub test { $@ = 'Oops'; my( $x ) = @_; print $x; # Oops } $@ = 'Exception'; test( $@ );