++ed by:

2 PAUSE user(s)

Andrew Main (Zefram)


Parse::Perl::Environment - reified Perl lexical environment


An object of this class encapsulates a lexical environment for Perl source code. Such an object can be used to influence Perl parsing, through the parse_perl function in Parse::Perl. An environment object is most commonly generated by capturing the environment of running Perl code, through the current_environment operator in Parse::Perl.

The things determined by the lexical environment, which are encapsulated by this class, include:

  • current package (controlled by package directives)

  • activation of warnings (controlled by the warnings module)

  • enforcement of language stricture (controlled by the strict module)

  • availability of optional language features (controlled by the feature module)

  • various other standard pragmata, such as integer, locale, sort, utf8

  • array base offset ($[)

  • the lexical hints hash %^H, and hence the various (mainly non-core) pragmata that are implemented through it

  • visibility of lexical variables (introduced by my, our, or state)

Objects of this class are not meant to be examined manually. The layout varies between Perl versions, and between versions of the Parse::Perl module.


This module provides no way to examine environments, or to create new environments other than by capturing an existing one. These shortcomings should be addressed in a future version.




Andrew Main (Zefram) <zefram@fysh.org>


Copyright (C) 2009, 2010, 2011, 2012 Andrew Main (Zefram) <zefram@fysh.org>


This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.