diff options
author | Chip Salzenberg <chip@perl.com> | 1997-04-03 10:03:18 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-04-03 10:03:25 +1200 |
commit | 09280a334577a8254c4115b822e1f8cc667611a1 (patch) | |
tree | 5248ec052bcee25ef7a4efc61f20a99d7e7a04e8 /t | |
parent | 8523fd8370f87f8e7cc44b73b86edff69f32270d (diff) | |
download | perl-09280a334577a8254c4115b822e1f8cc667611a1.tar.gz |
Fix AUTOLOAD, or kill me
Diffstat (limited to 't')
-rwxr-xr-x | t/op/method.t | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/t/op/method.t b/t/op/method.t index bdbc8a9673..21d7c8f397 100755 --- a/t/op/method.t +++ b/t/op/method.t @@ -64,6 +64,7 @@ test (eval { A->x } || "nope", "nope"); eval <<'EOF'; sub C::e; +BEGIN { *B::e = \&C::e } # Shouldn't prevent AUTOLOAD in original pkg sub Y::f; $counter = 0; @@ -73,14 +74,16 @@ $counter = 0; sub B::AUTOLOAD { my $c = ++$counter; my $method = $B::AUTOLOAD; - *$B::AUTOLOAD = sub { "B: In $method, $c" }; - goto &$B::AUTOLOAD; + my $msg = "B: In $method, $c"; + eval "sub $method { \$msg }"; + goto &$method; } sub C::AUTOLOAD { my $c = ++$counter; my $method = $C::AUTOLOAD; - *$C::AUTOLOAD = sub { "C: In $method, $c" }; - goto &$C::AUTOLOAD; + my $msg = "C: In $method, $c"; + eval "sub $method { \$msg }"; + goto &$method; } EOF |