Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can the Perl debugger save the ReadLine history to a file?

I work quit a bit with lib ReadLine and the lib Perl Readline.

Yet, the Perl debugger refuses to save the session command line history.

Thus, each time I invoke the debugger I lose all of my previous history.

Does anyone know how to have the Perl debugger save, and hopefully, append session history similar to the bash HISTORYFILE ?

like image 908
bitbucket Avatar asked Jun 21 '11 23:06

bitbucket


People also ask

What is Perl debugger?

The Perl debugger enables you to specify one or more statements to be executed whenever the program reaches a specified line. Such statements are known as line actions. The most common line actions are printing the value of a variable and resetting a variable containing an erroneous value to the value you want.

How do I debug a Perl file?

In Perl, the debugger is not a separate program the way it usually is in the typical compiled environment. Instead, the -d flag tells the compiler to insert source information into the parse trees it's about to hand off to the interpreter.

How do you set a breakpoint in Perl debugger?

b-command is used to set a breakpoint in a program. Whenever a specified line is about to be executed, this command tells the debugger to halt the program.


3 Answers

The way I do this is by having the following line in my ~/.perldb file:

&parse_options("HistFile=$ENV{HOME}/.perldb.hist");

Debugger commands are then stored in ~/.perldb.hist and accessible across sessions.

like image 161
mirod Avatar answered Nov 07 '22 00:11

mirod


Add parse_options("TTY=/dev/stdin ReadLine=0"); to .perldb, then:

rlwrap -H .perl_history perl -d ...
like image 25
ysth Avatar answered Nov 06 '22 22:11

ysth


$ export PERLDB_OPTS=HistFile=$HOME/.perldb.history 
like image 45
mephinet Avatar answered Nov 06 '22 22:11

mephinet