Variable::Expand::AnyLevel - expand variables exist at any level.
use Variable::Expand::AnyLevel qw(expand_variable); my $value1 = 'aaa'; my $value2 = expand_variable('$value1', 0); # $value2 is 'aaa';
Variable::Expand::AnyLevel enables to expand variables which exist at any level. (level means same as Carp or PadWalker)
Expand variable in $string which exists in $peek_level. $peek_level is same as caller().
If stringify option specified(it is default) $string is correctly expanded. For example,
my $aa = 'aa'; my $result = $expand_variable('$aa 123', 0);
$result is expanded 'aa 123'
If stringify option is set to '0', $string is not expanded.
my $aa = 'aa'; my $result = $expand_variable('$aa 123', 0, { stringify => '0' });
$result is undef.
available options are as follows
stringify: stringify variable(1) or not(0). default value is 1
Takuya Tsuchida <tsucchi@cpan.org>
PadWalker
Copyright (c) 2011 Takuya Tsuchida
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Variable::Expand::AnyLevel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Variable::Expand::AnyLevel
CPAN shell
perl -MCPAN -e shell install Variable::Expand::AnyLevel
For more information on module installation, please visit the detailed CPAN module installation guide.