[英]Why do I get .perldb alias syntax error when trying to display source?
I would like to display whole source code of perl script. 我想显示perl脚本的整个源代码。 Following line was added to .perldb:
将以下行添加到.perldb:
$DB::alias{'code'} = 'l 1+99999;';
the .perldb chmod is set to 700. After issuing my alias I get following error: .perldb chmod设置为700。发出别名后,出现以下错误:
DB<1> code
Number found where operator expected at (eval 8)[/usr/share/perl5/perl5db.pl:2312] line 1, near "l 1"
(Do you need to predeclare l?)
Couldn't evaluate `code' alias: syntax error at (eval 8)[/usr/share/perl5/perl5db.pl:2312] line 1, near "l 1"
alias seems to be loaded correctly: 别名似乎已正确加载:
DB<2> =
code l 1+100;
EDIT : When I define alias using '=' command it works as expected: 编辑 :当我使用'='命令定义别名时,它按预期工作:
DB<2> = code l 1+99999
shcd = l 1+99999
DB<3> =
code l 1+99999
what I am doing wrong? 我做错了什么?
You have to declare the alias code
and remove that content with the command you want to run. 您必须声明别名
code
然后使用要运行的命令删除该内容。 So inside the .perldb
do a substitution command to get it, like: 因此,在
.perldb
内部执行替换命令来获取它,例如:
$DB::alias{ 'code' } = 's/^.*$/l 1+99999/';
And then in the debugger use: 然后在调试器中使用:
DB<100> code
And it will output the whole code of the script (if has less lines that one hundred thousand :-) 它将输出脚本的全部代码(如果行数少于十万,则为:-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.