develooper Front page | perl.perl5.porters | Postings from August 2001

Re: The coderef in @INC strikes back

Thread Previous | Thread Next
From:
Jonathan Stowe
Date:
August 22, 2001 01:05
Subject:
Re: The coderef in @INC strikes back
Message ID:
Pine.LNX.4.33.0108220744320.26155-100000@orpheus.gellyfish.com
On Tue, 21 Aug 2001, Rafael Garcia-Suarez wrote:

> Do you remember this little odd feature that allows to add
> a coderef in @INC? See the digest for info :
>
> http://www.perl.com/pub/a/2001/03/p5pdigest/THISWEEK-20010305.html#Coderef_INC
>
> AFAIK, this feature has been left unfinished in the core :
> there are no docs and no tests for it.
>

So I sat down with my computer with a view to seeing what I could do about
this and whilst writing a test to determine what use could be made of the
coderef that is passed to the subroutine I  came up with :

#!/usr/bin/perl -w

use strict;

BEGIN
{
   push @INC , bless( sub { print "*@_*" }, 'Foo');
}

use Foggle;


Which to my surprise gives :

Can't locate object method "INC" via package "Foo" (perhaps you forgot to
load "Foo"?) at inctest.pl line 10.
BEGIN failed--compilation aborted at inctest.pl line 10.


Now maybe I shouldnt be surprised and maybe I have missed something here
but to me this looks like it wants me to define Foo::INC() - but even
doing that doesnt help.

A cursory examination of the code of pp_require() seems to suggest that it
should work - is this just not finished ?

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


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