Commit | Line | Data |
---|---|---|
a687059c | 1 | #!./perl |
2 | ||
9508c957 | 3 | print "1..14\n"; |
a687059c | 4 | |
5 | $blurfl = 123; | |
6 | $foo = 3; | |
7 | ||
c09412fc | 8 | package xyz; |
a687059c | 9 | |
e27ad1f2 | 10 | sub new {bless [];} |
11 | ||
a687059c | 12 | $bar = 4; |
13 | ||
14 | { | |
15 | package ABC; | |
16 | $blurfl = 5; | |
17 | $main'a = $'b; | |
18 | } | |
19 | ||
20 | $ABC'dyick = 6; | |
21 | ||
22 | $xyz = 2; | |
23 | ||
a0d0e21e | 24 | $main = join(':', sort(keys %main::)); |
c09412fc | 25 | $xyz = join(':', sort(keys %xyz::)); |
a0d0e21e | 26 | $ABC = join(':', sort(keys %ABC::)); |
a687059c | 27 | |
9d116dd7 | 28 | if ('a' lt 'A') { |
e27ad1f2 | 29 | print $xyz eq 'bar:main:new:xyz:ABC' ? "ok 1\n" : "not ok 1 '$xyz'\n"; |
9d116dd7 | 30 | } else { |
e27ad1f2 | 31 | print $xyz eq 'ABC:bar:main:new:xyz' ? "ok 1\n" : "not ok 1 '$xyz'\n"; |
9d116dd7 | 32 | } |
463ee0b2 | 33 | print $ABC eq 'blurfl:dyick' ? "ok 2\n" : "not ok 2 '$ABC'\n"; |
a687059c | 34 | print $main'blurfl == 123 ? "ok 3\n" : "not ok 3\n"; |
463ee0b2 | 35 | |
a687059c | 36 | package ABC; |
463ee0b2 | 37 | |
a687059c | 38 | print $blurfl == 5 ? "ok 4\n" : "not ok 4\n"; |
39 | eval 'print $blurfl == 5 ? "ok 5\n" : "not ok 5\n";'; | |
40 | eval 'package main; print $blurfl == 123 ? "ok 6\n" : "not ok 6\n";'; | |
41 | print $blurfl == 5 ? "ok 7\n" : "not ok 7\n"; | |
7ad382f4 | 42 | |
43 | package main; | |
44 | ||
45 | sub c { caller(0) } | |
46 | ||
47 | sub foo { | |
48 | my $s = shift; | |
49 | if ($s) { | |
50 | package PQR; | |
51 | main::c(); | |
52 | } | |
53 | } | |
54 | ||
55 | print((foo(1))[0] eq 'PQR' ? "ok 8\n" : "not ok 8\n"); | |
e27ad1f2 | 56 | |
57 | my $Q = xyz->new(); | |
58 | undef %xyz::; | |
59 | eval { $a = *xyz::new{PACKAGE}; }; | |
f0f07b90 | 60 | print $a eq "__ANON__" ? "ok 9\n" : "not ok 9 # '$a'\n"; |
e27ad1f2 | 61 | |
62 | eval { $Q->param; }; | |
63 | print $@ =~ /^Can't use anonymous symbol table for method lookup/ ? | |
f0f07b90 | 64 | "ok 10\n" : "not ok 10 # '$@'\n"; |
e27ad1f2 | 65 | |
f0f07b90 | 66 | print "$Q" =~ /^__ANON__=/ ? "ok 11\n" : "not ok 11 # '$Q'\n"; |
e27ad1f2 | 67 | |
f0f07b90 | 68 | print ref $Q eq "__ANON__" ? "ok 12\n" : "not ok 12 # '$Q'\n"; |
e27ad1f2 | 69 | |
9508c957 | 70 | package bug32562; |
e27ad1f2 | 71 | |
9508c957 | 72 | print __PACKAGE__ eq 'bug32562' ? "ok 13\n" : "not ok 13\n"; |
73 | print eval '__PACKAGE__' eq 'bug32562' ? "ok 14\n" : "not ok 14\n"; |