Lexical-Util

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    use Lexical::Util qw(frame_to_cvref lexalias ref_to_lexical);

    $cvref = frame_to_cvref($level);
    lexalias($cvref, '$name', \$variable);
    $ref = ref_to_lexical($cvref, '$name');

DESCRIPTION

    Lexical::Util is a module containing some common routines used by
    modules dealing with the lexical variables of routines other than
    their own. They are taken from various sources, including PadWalker,
    Perl6::Binding, and Lexical::Alias. This module is used in version
    0.7 and greater of Perl6::Binding, as well as in the
    Object::Variables and Sub::Declaration packages, to prevent
    duplication of code.

    This package should not be needed or used by end users.

    Note: this module uses the CvPADLIST and CvDEPTH macros, which are
    listed in perlintern and not part of the perl API. They work in the
    versions I've been able to test on (5.6.1 and 5.8.4), but may change

lib/Lexical/Util.pm  view on Meta::CPAN


	$cvref = frame_to_cvref($level);
	lexalias($cvref, '$name', \$variable);
	$err = lexical_alias($cvref, '$name', \$variable);
	$ref = ref_to_lexical($cvref, '$name');

=head1 DESCRIPTION

C<Lexical::Util> is a module containing some common routines used by modules
dealing with the lexical variables of routines other than their own. They are
taken from various sources, including L<PadWalker|PadWalker>,
L<Perl6::Binding|Perl6::Binding>, and L<Lexical::Alias|Lexical::Alias>. This
module is used in version 0.7 and greater of Perl6::Binding, as well as in the
L<Object::Variables|Object::Variables> and L<Sub::Declaration|Sub::Declaration>
packages, to prevent duplication of code.

This package should I<not> be needed or used by end users.

Note: this module uses the L<CvPADLIST|perlintern/CvPADLIST> and CvDEPTH macros,
which are listed in L<perlintern|perlintern> and not part of the perl API. They
work in the versions I've been able to test on (5.6.1 and 5.8.4), but may change

lib/Lexical/Util.pm  view on Meta::CPAN

If I<$cvref> is the scalar 0, then B<lexalias> must have been called
from the top level of the program (outside of any subroutines) and the
variable being aliased must also exist at the top level. This doesn't
appear to work under the debugger, however. I hope to eliminate this
restriction with more research.

=back

=head1 SEE ALSO

L<Perl6::Binding>, L<PadWalker|PadWalker>, L<Lexical::Alias|Lexical::Alias>

=head1 COPYRIGHT AND LICENSE

Copyright 2004 Kevin Michael Vail

This program is free software.  It may be copied and/or redistributed under the
same terms as Perl itself.

=head1 AUTHOR



( run in 0.693 second using v1.01-cache-2.11-cpan-05444aca049 )