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