b $var Set breakpoint at first line of
subroutine referenced by $var.
####
$ cat namevsref.pl
use warnings;
use strict;
my $time = 1;
my $x = sub {
print "Inside sub. time = ".($time++)."\n";
};
no strict 'refs';
*{"tutu"} = $x;
$x->();
tutu();
####
pp2@nereida:~/src/perl/testing$ perl -wd namevsref.pl
Loading DB routines from perl5db.pl version 1.28
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(namevsref.pl:4): my $time = 1;
DB<1> l 1,14
1: use warnings;
2: use strict;
3
4==> my $time = 1;
5
6 my $x = sub {
7: print "Inside sub. time = ".($time++)."\n";
8: };
9
10: no strict 'refs';
11: *{"tutu"} = $x;
12
13: $x->();
14: tutu();
DB<2> c 11
main::(namevsref.pl:11): *{"tutu"} = $x;
DB<3> x $x
0 CODE(0x825a074)
-> &main::__ANON__[namevsref.pl:8] in namevsref.pl:6-8
DB<4> b $x
DB<5> L
namevsref.pl:
11: *{"tutu"} = $x;
break if ($x)
DB<5> c
Inside sub. time = 1
Inside sub. time = 2
Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
DB<5>