This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make ‘require $tied_undef’ behave consistently
authorFather Chrysostomos <sprout@cpan.org>
Sun, 10 Aug 2014 05:09:17 +0000 (22:09 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 10 Aug 2014 05:09:17 +0000 (22:09 -0700)
commit672794ca55bc11c78c1244bba9039f731071e1bf
tree241fbe3c02fcc944142b0c0082e7c68f1c36e6b8
parentf51551f7eae700328787f130fa35783726046e35
Make ‘require $tied_undef’ behave consistently

As of f04d2c345 perl does not give uninitialized warnings for ‘require
undef’.  But the check was not happening soon enough, causing tied
variables to behave erratically:

$ ./perl -Ilib -we 'sub TIESCALAR{bless[]}sub FETCH{undef}sub STORE{}tie $x,""; $x="a"; require $x'
Use of uninitialized value $x in require at -e line 1.
Missing or undefined argument to require at -e line 1.

(Uninit warning where muggle variables lack one.)

$ ./perl -Ilib -we 'sub TIESCALAR{bless[]}sub FETCH{undef}sub STORE{}tie $x,""; $x=3; require $x'
Invalid version format (non-numeric data) at -e line 1.

(undef being treated as a version string.)

We have to call get-magic on the argument before we check its
definedness.
pp_ctl.c
t/op/require_override.t