Devel::LexAlias3pm
Alias lexical variables
Usage
use Devel::LexAlias qw(lexalias);sub steal_my_x {my $foo = 1;lexalias(1, '$x', \$foo);}sub foo {my $x = 22;print $x; # prints 22steal_my_x;print $x; # prints 1}
Overview
Devel::LexAlias provides the ability to alias a lexical variable in a subroutines scope to one of your choosing.
If you don't know why you'd want to do this, I'd suggest that you skip this module. If you think you have a use for it, I'd insist on it.
Still here?
- lexalias( $where, $name, $variable )
-
$whererefers to the subroutine in which to alias the lexical, it can be a coderef or a call level such that you'd give to"caller"$nameis the name of the lexical within that subroutine$variableis a reference to the variable to install at that location
Releases
9 releases since Debian 5.0 (Lenny); the text changed 7 times.