develooper Front page | perl.perl5.porters | Postings from October 2011

Undefining %File::Glob::

Thread Next
From:
Father Chrysostomos
Date:
October 23, 2011 13:07
Subject:
Undefining %File::Glob::
Message ID:
A64C345F-F34B-4D5E-8C22-BF617D930631@cpan.org
Loading a package, undeffing it, and then expecting it to work is obviously questionable.

Yet there are tests to make sure that glob() still works after undef %File::Glob::.  In that case, Perl reverts to using csh for any subsequently-compiled glob() ops.  Existing ops produce an ‘undefined subroutine’ error.

It seems to me that the tests were only added because glob used to crash if %File::Glob:: were undefined.

I’m trying to make CORE::glob work, as currently it respects overrides, which it shouldn’t.  I’m doing that by adding a PL_globhook interpreter variable and making glob() work like lock().  File::Glob sets PL_globhook when it loads, but the hook does call_pv("File::Glob::csh_glob"), causing existing ‘undef %File::Glob::’ tests to fail.

Is it acceptable to adjusts those tests as being within the ‘don’t do that’ zone?

Alternatively I could rewrite csh_glob in C, which would make it faster.


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