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

Re: Recursive call to Perl_load_module in PerlIO_find_layer

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
January 25, 2004 12:32
Subject:
Re: Recursive call to Perl_load_module in PerlIO_find_layer
Message ID:
20040125213335.4228e512.rgarciasuarez@free.fr
Elizabeth Mattijsen wrote:
> Could anyone explain to me why this little gem:
> 
> =========================================
> BEGIN {
>      unshift( @INC,sub {
>          my $data; open( my $in,'<',\$data );
>      } );
> }
> use Foo;
> =========================================
> 
> dies with the error:
> 
>   Recursive call to Perl_load_module in PerlIO_find_layer line 3.
>   BEGIN failed--compilation aborted line 6.
>   BEGIN failed--compilation aborted line 6.

Because it tries to load PerlIO::Scalar while trying to load
PerlIO::Scalar.

> I ran into this while developing my new "ifdef" pragma (soon to be 
> found on CPAN, now also available from http://www.liz.nl/CPAN ).
> 
> I actually don't need the functionality to create a handle on a 
> scalar while in an @INC handler anymore, as I've chosen a line based 
> approach.  But it still makes me wonder why this is would be a 
> problem.  And if and how it can be circumvented.

You can shift() instead of unshift(), or load PerlIO::Scalar explicitly.

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