In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/b28683c9b5d157bf72cd93c7d257ed5b39dad090?hp=f57d8456e7b8d6b2dad0bb49899cfdc68007b794>
- Log ----------------------------------------------------------------- commit b28683c9b5d157bf72cd93c7d257ed5b39dad090 Author: David Mitchell <[email protected]> Date: Thu Apr 13 10:12:31 2017 +0100 fix perldiag entry for do '.' warning Its an enabled-by-default deprecation warning M pod/perldiag.pod commit cfe4f7b628c08bfdd986ec52e1ff99241d5047a3 Author: David Mitchell <[email protected]> Date: Mon Apr 10 12:43:02 2017 +0100 more tweaks to 'do's pod Make it clear that both ./ and ../ are special-cased. M pod/perlfunc.pod ----------------------------------------------------------------------- Summary of changes: pod/perldiag.pod | 2 +- pod/perlfunc.pod | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 3d911cb950..730010a882 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2063,7 +2063,7 @@ See L<perlfunc/pack>. =item do "%s" failed, '.' is no longer in @INC; did you mean do "./%s"? -(W deprecated) Previously C< do "somefile"; > would search the current +(D deprecated) Previously C< do "somefile"; > would search the current directory for the specified file. Since perl v5.26.0, F<.> has been removed from C<@INC> by default, so this is no longer true. To search the current directory (and only the current directory) you can write diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index c8140d58b7..38747a67bb 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1807,11 +1807,14 @@ X<do> Uses the value of EXPR as a filename and executes the contents of the file as a Perl script: - do './stat.pl'; # file located relative to the current dir - do '/foo/stat.pl'; # file located at the specified absolute path + # load the exact specified file (./ and ../ special-cased) + do '/foo/stat.pl'; + do './stat.pl'; + do '../foo/stat.pl'; - do 'stat.pl'; # file searched for within @INC - do 'foo/stat.pl'; # file searched for within @INC + # search for the named file within @INC + do 'stat.pl'; + do 'foo/stat.pl'; C<do './stat.pl'> is largely like @@ -1824,9 +1827,9 @@ 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 +Using C<do> with a relative path (except for F<./> and F<../>), like - do 'stat.pl'; + do 'foo/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> @@ -1855,7 +1858,8 @@ if there's a problem. You might like to use L<C<do>|/do EXPR> to read in a program configuration file. Manual error checking can be done this way: - # read in config files: system first, then user + # Read in config files: system first, then user. + # Beware of using relative pathnames here. for $file ("/share/prog/defaults.rc", "$ENV{HOME}/.someprogrc") { -- Perl5 Master Repository
