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. 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... > > 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. Why would removing stuff with shift() work. Do you mean push()? But that would defeat my purpose, as it then would only get called for modules that couldn't get loaded. LizThread Previous | Thread Next