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

久未见 提交于 2019-11-30 16:57:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!