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