t2.pl
1;
2;
3;
t.pl
package DB;
sub DB {
print "HERE";
our(undef, $f, undef) = caller;
*dbline = $main::{ "_<$f" };
$dbline{ 3 } = {};
$DB::single = 0;
}
1;
PERL5DB="BEGIN{ require 't.pl' }" perl -d t2.pl
When you run this code, you get HEREHERE, but the Perl magic variable does not work unless you use an alias with *dbline.
So, when you change the first two examples to look like this:
*dbline = $main::{ "_<$f" };
*x = $main::{ "_<$f" };
$x{ 3 } = { };
breakpoint starts to work. (This applies to Perl 5.14.4)
Why does it work this way?
Doc
source
share