develooper Front page | perl.perl5.porters | Postings from January 2005

Re: [PATCH bleadperl] Re: [perl #31924] %INC caching failure-caseproblem

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
January 21, 2005 06:02
Subject:
Re: [PATCH bleadperl] Re: [perl #31924] %INC caching failure-caseproblem
Message ID:
20050121150246.732ebc50@grubert.mandrakesoft.com
Rick Delaney wrote:
> On Sun, Oct 10, 2004 at 03:38:35PM -0000, Nicholas Clark wrote:
> > 
> > $ echo die >fail.pm
> > $ ./perl -Ilib -e 'eval "use fail q{:std};"; $INC{"fail.pm"} = "fail.pm"'
> > Modification of non-creatable hash value attempted, subscript "fail.pm" at -e line 1.
> > 
> > I think it's something to do with the code in blead which cached failure
> > cases for require, code which isn't in maint. (And I'm now more inclined to
> > leave it that way)
> 
> This is because as it is now, failed compiles are cached as PL_sv_undef
> which pp_helem is specifically coded to reject; I'm not sure why.
> 
> > The bug seems to need something aggressive such as a die inside the other
> > module to trigger the failure case - simply not returning true from the
> > module won't trigger it.
> 
> Right, because those cases are not cached as failures.
> 
> The following patch changes the caching placeholder to
> PL_sv_placeholder which apart from being a better name is also better
> because now
> 
>     keys %INC;
> 
> should only return the names of files successfully loaded.

Thanks, applied as #23843 to blead.

> There was no API that I could find to test if a key was in %INC and was
> a placeholder so I added one (hv_fetch_flags).  If there was another way
> or if it would have been better to make hv_fetch_common public then feel
> free to point me in the right direction and I'll change it.  If
> hv_fetch_flags is ok then I suppose hv_fetch should be changed to call
> it.

Thread Previous | Thread Next


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