This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make "require" handle no argument more gracefully, and add tests
authorYves Orton <demerphq@gmail.com>
Wed, 30 Jul 2014 13:44:44 +0000 (15:44 +0200)
committerYves Orton <demerphq@gmail.com>
Wed, 30 Jul 2014 13:44:47 +0000 (15:44 +0200)
commitf04d2c345149d984ed5180f12fa007908c91b131
treed80ea12650d331421ef76dd4dc836b9b590580a7
parent57d69a4016b981268198cf744741335a9b1fbb23
make "require" handle no argument more gracefully, and add tests

in Perl 5.14 the following segfaults:

    *CORE::GLOBAL::require = sub { }; eval "require";

in Perl 5.18

    perl -wle'eval "require";'

produces a spurious warning:

    Use of uninitialized value $_ in require at (eval 1) line 1.

In other perls:

    perl -e 'eval q/require $this/ or print $@'

produces:

    Null filename used at (eval 1) line 1.

The error message is crappy, totally unfit for a perl audience,
and the spurious warning is just confusing. There is no $_ in use
here, why do we warn about it.

It looks like 9e3fb20c fixed the segfault (by accident), and also
somehow meant that the "Null filename" error would not ever be
produced.

So this patch ditches the crappy error and replaces it with something
meaningful and informative, and tests that we do not regress and start
segfaulting again.
MANIFEST
pod/perldiag.pod
pp_ctl.c
t/op/require_override.t [new file with mode: 0644]