Devel::Chitin::GetVarAtLevel - Evaluate an expression in the debugged program's context

This module is the implementation behind the method Devel::Chitin::get_var_at_level(). It attempts to return the value of the given variable expression in the context of the debugged program, at some arbirtary stack frame.

It handles simple expressions like variables (which must include the sigil)

  • $my_variable

  • @our_variable

  • %bare_variable

  • $Some::Package::Variable

It also attempts to handle more complicated expressions such as elements and slices of arrays and hashes.

  • $hash{'key'}

  • @hash{'key1','key2', $var_with_key}

  • @array[ $first .. $second ]

Parsing of these more complicated expressions is handled by regexes instead of a proper grammar, and will probably blow up if you try anything really fancy.

When evaluating a variable, it first tries finding it as a my variable, then as an our variable, and finally as a variable in the package the requested call frame is in.




Anthony Brummett <>


Copyright 2014, Anthony Brummett. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.