Synopsis:
set auto eval [on|off]
Evaluate unrecognized debugger commands.
Often inside the debugger, one would like to be able to run arbitrary Perl commands without having to preface expressions with print
or eval
. Setting auto eval
on will cause unrecognized debugger commands to be evaluated as a Perl expression.
If the expression starts with %, @, or $ the context will be set to a hash, array or scalar accordingly.
Note that if auto eval is set, the message shown on type a bad debugger command changes from:
Undefined command: "fdafds". Try "help".
to something more Perl-specific such as:
Unquoted string "fdasfdsa" may clash with future reserved word
One other thing that trips people up is when setting auto eval is that there are some short debugger commands that sometimes one wants to use as a variable, such as in an assignment statement. For example:
s /a/b/ # Note the space after the s
is not a Perl substitute command but a "step" command when 'auto eval' is on because by default, s
is an alias for the debugger step
command. It is possible to remove that alias if this causes constant problem. Another possibility is to go into a real shell via the shell
command.
See also:
show auto eval
, and eval