Next | Hook::LexWrap | 14 |
The postwrapper can see the function's original return value
This is quite simple:
$return = &$original; $dummy = scalar $wrapper{post}->(@_, $return) if $wrapper{post};
Altering the return value is simple, but subtle:
return $return;
Variables in Perl function calls are aliased inside the called function
sub set_to_57 { $_[0] = 57 } my $x = 119; set_to_57($x); print "$x\n"; # prints 57!!
Assigning to $_[-1] inside of the postwrapper modifies $return!
Next | Copyright © 2003 M. J. Dominus |