问题
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
?
回答1:
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.
回答2:
Add parse_options("TTY=/dev/stdin ReadLine=0");
to .perldb, then:
rlwrap -H .perl_history perl -d ...
回答3:
$ export PERLDB_OPTS=HistFile=$HOME/.perldb.history
回答4:
I did the following:
1) Created ~/.perldb
, which did not exist previously.
2) Added &parse_options("HistFile=$ENV{HOME}/.perldb.hist");
from mirod's answer.
3) Added export PERLDB_OPTS=HistFile=$HOME/.perldb.history
to ~/.bashrc from mephinet's answer.
4) Ran source .bashrc
5) Ran perl -d my program.pl
, and got this warning/error
perldb: Must not source insecure rcfile /home/ics/.perldb.
You or the superuser must be the owner, and it must not
be writable by anyone but its owner.
6) I protected ~/.perldb
with owner rw chmod 700 ~/.perldb
, and the error went away.
来源:https://stackoverflow.com/questions/6433241/can-the-perl-debugger-save-the-readline-history-to-a-file