Re: hooks in @INC of the form &code:function::name
by Rafael Garcia-Suarez other posts by this author
Nov 26 2003 1:13PM messages near this date
Re: hooks in @INC of the form &code:function::name
|
[boost] Re: Re: Re: Suggestion regarding next() and prior()
Edward S. Peschko wrote:
>
> I'd like to make perl be able to handle syntax like:
>
> @INC = ( '&code:function::name', 'lib', 'lib2' );
>
> which would work the same as
>
> @INC = ( sub { }, 'lib', 'lib2' );
>
> except be more robust in being able to be evaluated (again, this is hurting in
> PAR, which uses code refs in @INC and hence doesn't handle AutoLoader.pm and
> Inline.pm very well - both of which use eval "use something" or require "something",
> which stringifies @INC and hence breaks any code refs in it).
Wouldn't blessed refs in @INC help, rather than plain coderefs ? (see perlfunc/require)
Regarding stringification, isn't this just a matter of fixing AutoLoader ?
e.g. :
Index: lib/AutoLoader.pm
===================================================================
--- lib/AutoLoader.pm (revision 2868)
+++ lib/AutoLoader.pm (working copy)
@@ -38,7 +38,7 @@ AUTOLOAD {
my ($pkg,$func) = ($sub =~ /(.*)::([^:]+)$/);
$pkg =~ s#::#/#g;
- if (defined($filename = $INC{"$pkg.pm"})) {
+ if (defined($filename = $INC{"$pkg.pm"}) and not ref $filename) {
if ($is_macos) {
$pkg =~ tr#/#:#;
$filename =~ s#^(.*)$pkg\.pm\z#$1auto:$pkg:$func.al#s;
>
> Anyways, I was trying to hunt down the patch that Ken Fox made on this (back in
> 1999) and can't find it via google. Is it available in the perl archives somewhere?
> If not, is there a good pointer into the code where it is available?
you can search the Changes* files and use the repository browser :
http://public.activestate.com/cgi-bin/perlbrowse
The diffs are also available on the APC (see perlhack)
Thread:
Edward S. Peschko
Nicholas Clark
Rafael Garcia-Suarez
|