New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify that '.' might not be in @INC any more #15884
Comments
From @jmdhCreated by @jmdhThis is a bug report for perl from dom@earth.li, ----------------------------------------------------------------- Please find attached a proposed patch. I might normally have committed From: Dominic Hargreaves <dom@earth.li> Documentation fixes for '.' possibly no longer being in @INC Inline Patchdiff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 10651b4f4f..88d30a55fd 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -1807,20 +1807,30 @@ X<do>
Uses the value of EXPR as a filename and executes the contents of the
file as a Perl script.
- do 'stat.pl';
+ do './stat.pl';
is largely like
eval `cat stat.pl`;
-except that it's more concise, runs no external processes, keeps track of
-the current filename for error messages, searches the
-L<C<@INC>|perlvar/@INC> directories, and updates L<C<%INC>|perlvar/%INC>
-if the file is found. See L<perlvar/@INC> and L<perlvar/%INC> for these
-variables. It also differs in that code evaluated with C<do FILE>
-cannot see lexicals in the enclosing scope; C<eval STRING> does. It's
-the same, however, in that it does reparse the file every time you call
-it, so you probably don't want to do this inside a loop.
+except that it's more concise, runs no external processes, and keeps
+track of the current filename for error messages. It also differs in that
+code evaluated with C<do FILE> cannot see lexicals in the enclosing
+scope; C<eval STRING> does. It's the same, however, in that it does
+reparse the file every time you call it, so you probably don't want
+to do this inside a loop.
+
+Using C<do> with no path, like
+
+ do 'stat.pl';
+
+will search the L<C<@INC>|perlvar/@INC> directories, and update
+L<C<%INC>|perlvar/%INC> if the file is found. See L<perlvar/@INC>
+and L<perlvar/%INC> for these variables. In particular, note that
+whilst historically L<C<@INC>|perlvar/@INC> contained '.' (the
+current directory) making these two cases equivalent, that is no
+longer necessarily the case, as there is now a compile-time option
+to disable this behaviour.
If L<C<do>|/do EXPR> can read the file but cannot compile it, it
returns L<C<undef>|/undef EXPR> and sets an error message in
diff --git a/pod/perlvar.pod b/pod/perlvar.pod
index b8c68b3455..2f776489be 100644
--- a/pod/perlvar.pod
+++ b/pod/perlvar.pod
@@ -503,9 +503,10 @@ initially consists of the arguments to any B<-I> command-line
switches, followed by the default Perl library, probably
F</usr/local/lib/perl>, followed by ".", to represent the current
directory. ("." will not be appended if taint checks are enabled,
-either by C<-T> or by C<-t>.) If you need to modify this at runtime,
-you should use the C<use lib> pragma to get the machine-dependent
-library properly loaded also:
+either by C<-T> or by C<-t>, or if configured not to do so by the
+C<-Ddefault_inc_excludes_dot> compile time option.) If you need to
+modify this at runtime, you should use the C<use lib> pragma to get
+the machine-dependent library properly loaded also:
use lib '/mypath/libdir/';
use SomeMod; Perl Info
|
From @jmdhPatch applied to blead. |
@jmdh - Status changed from 'new' to 'resolved' |
@jmdh - Status changed from 'resolved' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release today of Perl 5.26.0, this and 210 other issues have been Perl 5.26.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#130832 (status was 'resolved')
Searchable as RT130832$
The text was updated successfully, but these errors were encountered: