| Line | |
|---|
| 1 | #!./perl
|
|---|
| 2 |
|
|---|
| 3 | print "1..14\n";
|
|---|
| 4 |
|
|---|
| 5 | $blurfl = 123;
|
|---|
| 6 | $foo = 3;
|
|---|
| 7 |
|
|---|
| 8 | package xyz;
|
|---|
| 9 |
|
|---|
| 10 | sub new {bless [];}
|
|---|
| 11 |
|
|---|
| 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 |
|
|---|
| 24 | $main = join(':', sort(keys %main::));
|
|---|
| 25 | $xyz = join(':', sort(keys %xyz::));
|
|---|
| 26 | $ABC = join(':', sort(keys %ABC::));
|
|---|
| 27 |
|
|---|
| 28 | if ('a' lt 'A') {
|
|---|
| 29 | print $xyz eq 'bar:main:new:xyz:ABC' ? "ok 1\n" : "not ok 1 '$xyz'\n";
|
|---|
| 30 | } else {
|
|---|
| 31 | print $xyz eq 'ABC:bar:main:new:xyz' ? "ok 1\n" : "not ok 1 '$xyz'\n";
|
|---|
| 32 | }
|
|---|
| 33 | print $ABC eq 'blurfl:dyick' ? "ok 2\n" : "not ok 2 '$ABC'\n";
|
|---|
| 34 | print $main'blurfl == 123 ? "ok 3\n" : "not ok 3\n";
|
|---|
| 35 |
|
|---|
| 36 | package ABC;
|
|---|
| 37 |
|
|---|
| 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";
|
|---|
| 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");
|
|---|
| 56 |
|
|---|
| 57 | my $Q = xyz->new();
|
|---|
| 58 | undef %xyz::;
|
|---|
| 59 | eval { $a = *xyz::new{PACKAGE}; };
|
|---|
| 60 | print $a eq "__ANON__" ? "ok 9\n" : "not ok 9\n";
|
|---|
| 61 |
|
|---|
| 62 | eval { $Q->param; };
|
|---|
| 63 | print $@ =~ /^Can't use anonymous symbol table for method lookup/ ?
|
|---|
| 64 | "ok 10\n" : "not ok 10\n";
|
|---|
| 65 |
|
|---|
| 66 | print "$Q" =~ /^__ANON__=/ ? "ok 11\n" : "not ok 11\n";
|
|---|
| 67 |
|
|---|
| 68 | print ref $Q eq "__ANON__" ? "ok 12\n" : "not ok 12\n";
|
|---|
| 69 |
|
|---|
| 70 | package bug32562;
|
|---|
| 71 |
|
|---|
| 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";
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.