diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-11-30 22:05:03 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-11-30 22:05:03 -0800 |
commit | 0ea03996e7eb3b3be4ed648a954c083fc011f523 (patch) | |
tree | 2c74901023a04636a416df3c625d0a02d5efa973 /t/op | |
parent | c624397aee3afc3848b53f669b1d8c389701e29b (diff) | |
download | perl-0ea03996e7eb3b3be4ed648a954c083fc011f523.tar.gz |
[perl #105024] UNIVERSAL::AUTOLOAD and %+
The code in gv.c for loading a tie module automatically
(S_require_tie_mod) was only loading the module if its stash did not
exist or if a particular method (usually TIEHASH) could not be found.
But it was triggering autoloading, such that a universal AUTOLOAD
method would allow it to ‘find’ the method it was looking for, even if
it did not exist. So autovivifying the package somehow (e.g., by men-
tioning one of its symbols) could prevent the module from loading.
Diffstat (limited to 't/op')
-rw-r--r-- | t/op/magic.t | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/t/op/magic.t b/t/op/magic.t index d8d5063629..adbdad60d9 100644 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -5,7 +5,7 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require './test.pl'; - plan (tests => 147); + plan (tests => 150); } # Test that defined() returns true for magic variables created on the fly, @@ -529,6 +529,24 @@ foreach my $sig (qw(__DIE__ _BOGUS_HOOK KILL THIRSTY)) { } +SKIP: { + skip_if_miniperl("No XS in miniperl", 3); + + for ( [qw( %- Tie::Hash::NamedCapture )], [qw( $[ arybase )], + [qw( %! Errno )] ) { + my ($var, $mod) = @$_; + my $modfile = $mod =~ s|::|/|gr . ".pm"; + fresh_perl_is + qq 'sub UNIVERSAL::AUTOLOAD{} + $mod\::foo() if 0; + $var; + print "ok\\n" if \$INC{"$modfile"}', + "ok\n", + { switches => [ '-X' ] }, + "$var still loads $mod when stash and UNIVERSAL::AUTOLOAD exist"; + } +} + # ^^^^^^^^^ New tests go here ^^^^^^^^^ SKIP: { |