Acme-Lexical-Thief
view release on metacpan or search on metacpan
CONTRIBUTING view on Meta::CPAN
not, then try <https://github.com/tobyink> or submit a bug report.
(As far as I'm concerned the lack of a link is a bug.) Many of my
distributions are also mirrored at <https://bitbucket.org/tobyink>.
To submit the patch, do a pull request on GitHub or Bitbucket, or
attach a diff file to a bug report. Unless otherwise stated, I'll
assume that your contributions are licensed under the same terms as
the rest of the project.
(If using git, feel free to work in a branch. For Mercurial, I'd
prefer bookmarks within the default branch.)
* Documentation
If there's anything unclear in the documentation, please submit this
as a bug report or patch as above.
Non-toy example scripts that I can bundle would also be appreciated.
* Translation
variable which is lexically aliased (`local *car`) to the caller's
variable of the same name. Because `steal` is parsed at compile-time, you
don't need to (and indeed should not!) pre-declare your stolen variables.
sub greet_verbally {
my $name; # don't do this!
steal $name;
say "Hello $name";
}
By default, this module steals from your *immediate* caller. You can
thieve higher up the call stack using:
steal 0 ($car); # caller's $car
steal 1 @boats; # caller's caller's @boats
steal 2 %stash; # caller's caller's caller's @stash
You cannot indicate the level you wish to steal from using a variable; it
must be a literal integer in your source code. (It can be in decimal,
octal, hexadecimal or binary notation.) The integer must immediately
follow the `steal` keyword, and not be followed by a comma.
lib/Acme/Lexical/Thief.pm view on Meta::CPAN
variable of the same name. Because C<steal> is parsed at compile-time,
you don't need to (and indeed should not!) pre-declare your stolen
variables.
sub greet_verbally {
my $name; # don't do this!
steal $name;
say "Hello $name";
}
By default, this module steals from your I<immediate> caller. You can
thieve higher up the call stack using:
steal 0 ($car); # caller's $car
steal 1 @boats; # caller's caller's @boats
steal 2 %stash; # caller's caller's caller's @stash
You cannot indicate the level you wish to steal from using a variable; it
must be a literal integer in your source code. (It can be in decimal, octal,
hexadecimal or binary notation.) The integer must immediately follow the
C<steal> keyword, and not be followed by a comma.
( run in 0.265 second using v1.01-cache-2.11-cpan-0a6323c29d9 )