develooper Front page | perl.perl5.porters | Postings from June 2009

Re: [perl #66942] ./ in @INC leads to wrong results in %INC

Thread Previous
From:
Rafael Garcia-Suarez
Date:
June 25, 2009 11:00
Subject:
Re: [perl #66942] ./ in @INC leads to wrong results in %INC
Message ID:
b77c1dce0906251100k47bd399eh93e4a0f38a655660@mail.gmail.com
2009/6/25 Frank Wiegand <perlbug-followup@perl.org>:
> Unshifting the »./« path to @INC leads to wrong results in the %INC hash:
>
>  % pwd
>  /tmp
>
>  % cat Foo.pm
>  package Foo;
>  1;
>
>  % perl -le 'unshift @INC, "./"; require Foo; print $INC{"Foo.pm"}'
>  /Foo.pm
>
> Output should be »./Foo.pm«, »/Foo.pm« does not exist.

Thanks for the report. This should be solved by the following change:

commit e63be7465b2d564165a64209685cfd7026a2005b
Author: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Date:   Thu Jun 25 19:57:19 2009 +0200

    Trim all trailing / from "." in @INC when filling %INC

    This fixes bug #66942 : as a / was left in the directory name,
    $INC{"Foo.pm"} for a file loaded from the current directory
    was given the incorrect value "/Foo.pm".

 pp_ctl.c       |    6 ++++--
 t/run/runenv.t |   17 ++++++++++++++++-
 2 files changed, 20 insertions(+), 3 deletions(-)

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About