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
The "../" relative path misbehaving with regard to default_inc_excludes_dot #15941
Comments
From @andk"../foo" seems not to be regarded as a relative path, leading to this bug: perl -e ' Expected behaviour would be to see a warning like do "../ty2En/do_this.pl" failed, '.' is no longer in @INC; did you mean do "./../ty2En/do_this.pl"? at -e line 8. -- |
From @iabynOn Tue, Apr 04, 2017 at 01:04:36PM -0700, Andreas J. Koenig via RT wrote:
This has been the behaviour of do (and require) since at least 5.6.1: $ pwd $ cat foo.pl $ cat ~/tmp/p $ perl561o ~/tmp/p $ perl52511 ~/tmp/p I expect this behaviour is intentional (although to 'do' pod entry is -- |
The RT System itself - Status changed from 'new' to 'open' |
From @haargOn Wed, Apr 5, 2017 at 9:31 AM, Dave Mitchell <davem@iabyn.com> wrote:
It is definitely intentional behavior. Both do and require have a |
From @khwilliamsonOn Wed, 05 Apr 2017 02:03:33 -0700, haarg wrote:
This should be documented, as it apparently has confused some people. -- |
From @iabynOn Sat, Apr 08, 2017 at 10:19:06AM -0700, Karl Williamson via RT wrote:
Now done: commit cfe4f7b more tweaks to 'do's pod Affected files ... Differences ... Inline Patchdiff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index c8140d5..38747a6 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")
{
-- A power surge on the Bridge is rapidly and correctly diagnosed as a faulty |
@iabyn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#131100 (status was 'resolved')
Searchable as RT131100$
The text was updated successfully, but these errors were encountered: