3 BEGIN { print "1..10\n"; $^P |= 0x210 }
8 my $x = subname foo => sub { (caller 0)[3] };
9 my $line = __LINE__ - 1;
11 my $anon = $DB::sub{"main::__ANON__[${file}:${line}]"};
13 print $x->() eq "main::foo" ? "ok 1\n" : "not ok 1\n";
21 print $x->() eq "Blork:: Bar!" ? "ok 2\n" : "not ok 2\n";
23 subname "Foo::Bar::Baz", $x;
24 print $x->() eq "Foo::Bar::Baz" ? "ok 3\n" : "not ok 3\n";
26 subname "subname (dynamic $_)", \&subname for 1 .. 3;
29 subname "Dynamic $_", $x;
30 print $x->() eq "Blork::Dynamic $_" ? "ok $_\n" : "not ok $_\n";
33 print $DB::sub{"main::foo"} eq $anon ? "ok 6\n" : "not ok 6\n";
36 print $DB::sub{"Blork::Dynamic $_"} eq $anon ? "ok ".($_+3)."\n" : "not ok ".($_+3)."\n";
40 for ("Blork:: Bar!", "Foo::Bar::Baz") {
41 print $DB::sub{$_} eq $anon ? "ok $i\n" : "not ok $_ \n";