3 # Tests for the coderef-in-@INC feature
10 unless ($Config{useperlio}) {
11 print "1..0 # Skipping (tests are implemented using perlio features, this perl uses stdio)\n";
18 my ($self, $filename) = @_;
19 if (substr($filename,0,3) eq 'Foo') {
20 open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
30 print "not " if eval { require Bar };
32 print "not " if ! eval { require Foo } or ! exists $INC{'Foo.pm'};
34 print "not " if ! eval "use Foo1; 1;" or ! exists $INC{'Foo1.pm'};
36 print "not " if ! eval { do 'Foo2.pl' } or ! exists $INC{'Foo2.pl'};
42 my ($self, $filename) = @_;
43 if (substr($filename, 0, length($self->[1])) eq $self->[1]) {
44 open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
52 push @INC, [ \&fooinc2, 'Bar' ];
54 print "not " if ! eval { require Foo }; # Already loaded
56 print "not " if eval { require Foo3 };
58 print "not " if ! eval { require Bar } or ! exists $INC{'Bar.pm'};
60 print "not " if ! eval "use Bar1; 1;" or ! exists $INC{'Bar1.pm'};
62 print "not " if ! eval { do 'Bar2.pl' } or ! exists $INC{'Bar2.pl'};
68 my ($self, $filename) = @_;
69 if (substr($filename,0,4) eq 'Quux') {
70 open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
78 push @INC, bless( {}, 'FooLoader' );
80 print "not " if ! eval { require Quux } or ! exists $INC{'Quux.pm'};
85 push @INC, bless( [], 'FooLoader' );
87 print "not " if ! eval { require Quux1 } or ! exists $INC{'Quux1.pm'};
92 push @INC, bless( \(my $x = 1), 'FooLoader' );
94 print "not " if ! eval { require Quux2 } or ! exists $INC{'Quux2.pm'};