Debugger aliases do not work

V

Volker Nicolai

Hi,

I have tried to use aliases in the Perl debugger.
Running my script-to_debug in the Perl debugger
I included a debug module I wrote and set an alias for invoking it:

DB<10> use dump_vars;

DB<11> = dvo dump_all_vars (\%main::, "main::","");
or
DB<11> $alias{dvo} = 'dump_all_vars (\%main::, "main::","");'

But neither of these works, nor does one of these:
= dvo 'dump_all_vars (\%main::, "main::","");'
= dvo dump_all_vars(\%main::,"main::","");
= dvo "dump_all_vars (\%main::, \"main::\",\"\");"


For the '$alias =...' setting above I get this when trying to use it:
Bareword found where operator expected at (eval
64)[/cadappl/perl/5.6.1/lib/5.6.1/perl5db.pl:1521] line 2, near
""dump_all_vars (%main::, "main::"
(Missing operator before main::?)
String found where operator expected at (eval
64)[/cadappl/perl/5.6.1/lib/5.6.1/perl5db.pl:1521] line 2, near
"main::",""
String found where operator expected at (eval
64)[/cadappl/perl/5.6.1/lib/5.6.1/perl5db.pl:1521] line 2, near
"","");""
(Missing operator before ");"?)
syntax error at (eval
64)[/cadappl/perl/5.6.1/lib/5.6.1/perl5db.pl:1521] line 2, near
""dump_all_vars (%main::, "main::"

The same holds for the last "=dvo..." above
The other ones seem to cause the invokation of my sub without
arguments.

What happens here? Why don't my aliases work?
How to properly set aliases in the debugger?
Thanks for helping.
Volker
 
P

Peter Scott

Hi,

I have tried to use aliases in the Perl debugger.
Running my script-to_debug in the Perl debugger
I included a debug module I wrote and set an alias for invoking it:

DB<10> use dump_vars;

DB<11> = dvo dump_all_vars (\%main::, "main::","");
or
DB<11> $alias{dvo} = 'dump_all_vars (\%main::, "main::","");'

But neither of these works, nor does one of these:
= dvo 'dump_all_vars (\%main::, "main::","");'
= dvo dump_all_vars(\%main::,"main::","");
= dvo "dump_all_vars (\%main::, \"main::\",\"\");" [snip]
The other ones seem to cause the invokation of my sub without
arguments.

What happens here? Why don't my aliases work?
How to properly set aliases in the debugger?

The syntax for setting an alias is:

= <whitespace>* <word> <whitespace>+ <string>

And for invoking it,

<word> [<whitespace>+ <string>]

It operates very simply: the <string> in the setting is
substitued for the <word> in the invocation with s///.
Therefore you can pass arguments, but not insert them
in between parens.

DB<1> = add print 42 +
add = print 42 +
DB<2> add 17
59
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top