Elizabeth Mattijsen wrote: > > At 21:33 +0100 1/25/04, Rafael Garcia-Suarez wrote: > >Elizabeth Mattijsen wrote: > > > 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. > > Indeed. This works like a charm: > > BEGIN { > require PerlIO::Scalar; > unshift( @INC,sub { > my $data; open( my $in,'<',\$data ); > } ); > } > use Foo; > > But I would never have gotten from the error message to this fix. The error message could be made clearer. But I can't think about a good error message offhand. > But this implies that PerlIO::Scalar is only loaded the first time > you try to do an open() like that. Are there many more situations > like that in Perl nowadays? Is there a list of this modules that get > automatically loaded on demand? Could be important for optimizing > Perl on mod_perl prefork MPMs... Errno, File::Glob, utf8, attributes, and several PerlIO:: modules, e.g. all PerlIO::via::*. > Why would removing stuff with shift() work. Do you mean push()? Yes, of course !Thread Previous | Thread Next