Bug#839536: "do EXPR" no longer behaves as documented with '.' removed from @INC
Niko Tyni
ntyni at debian.org
Sun Oct 2 18:59:36 UTC 2016
On Sat, Oct 01, 2016 at 12:26:14PM -0400, Anthony DeRobertis wrote:
> Package: perl
> Version: 5.24.1~rc3-3
> Severity: normal
> do EXPR Uses the value of EXPR as a filename and executes the contents of
> the file as a Perl script.
>
> do 'stat.pl';
>
> is largely like
>
> eval `cat stat.pl`;
>
> But it's not like that eval at all, because do no longer searches the
> current working directory. You now have to write:
>
> do './stat.pl'
>
> That also means it's not really using the value of EXPR as a filename
> (compare to, e.g., "open" which also takes a filename).
You snipped the 'except' part where it says it searches @INC directories.
That implies it can't use the filename as-is but has to do some
concatenation. The current working directory was never a special case,
so things earlier on @INC would override the one in cwd.
I'd say there's enough similarility in the behaviour apart from this that
'largely like' is not incorrect.
> Surprisingly, even though the above works, this does not:
>
> do 'subdir/file.pl'
>
> seems as if q{./} is doing something magical.
'subdir/file.pl' gets searched in @INC, './subdir/file.pl' doesn't because
it's explicitly relative to cwd. This could indeed be documented better.
> This breaks Config::Any::Perl, or at least a lot of usages of it that
> used to work. Filing a bug there as well.
This is unfortunate of course. Thanks for reporting it.
--
Niko Tyni ntyni at debian.org
More information about the Perl-maintainers
mailing list