Lines Matching full:inc

3 # Tests for the coderef-in-@INC feature
46 push @INC, \&fooinc;
54 ok( exists $INC{'Foo.pm'}, ' %INC sees Foo.pm' );
55 is( ref $INC{'Foo.pm'}, 'CODE', ' val Foo.pm is a coderef in %INC' );
56 is( $INC{'Foo.pm'}, \&fooinc, ' val Foo.pm is correct in %INC' );
61 ok( exists $INC{'Foo1.pm'}, ' %INC sees Foo1.pm' );
62 is( ref $INC{'Foo1.pm'}, 'CODE', ' val Foo1.pm is a coderef in %INC' );
63 is( $INC{'Foo1.pm'}, \&fooinc, ' val Foo1.pm is correct in %INC' );
68 ok( exists $INC{'Foo2.pl'}, ' %INC sees Foo2.pl' );
69 is( ref $INC{'Foo2.pl'}, 'CODE', ' val Foo2.pl is a coderef in %INC' );
70 is( $INC{'Foo2.pl'}, \&fooinc, ' val Foo2.pl is correct in %INC' );
72 pop @INC;
86 push @INC, $arrayref;
92 ok( !$evalret, 'Original magic INC purged' );
97 ok( exists $INC{'Bar.pm'}, ' %INC sees Bar.pm' );
98 is( ref $INC{'Bar.pm'}, 'ARRAY', ' val Bar.pm is an arrayref in %INC' );
99 is( $INC{'Bar.pm'}, $arrayref, ' val Bar.pm is correct in %INC' );
102 ok( exists $INC{'Bar1.pm'}, ' %INC sees Bar1.pm' );
103 is( ref $INC{'Bar1.pm'}, 'ARRAY', ' val Bar1.pm is an arrayref in %INC' );
104 is( $INC{'Bar1.pm'}, $arrayref, ' val Bar1.pm is correct in %INC' );
107 ok( exists $INC{'Bar2.pl'}, ' %INC sees Bar2.pl' );
108 is( ref $INC{'Bar2.pl'}, 'ARRAY', ' val Bar2.pl is an arrayref in %INC' );
109 is( $INC{'Bar2.pl'}, $arrayref, ' val Bar2.pl is correct in %INC' );
111 pop @INC;
113 sub FooLoader::INC {
124 push @INC, $href;
129 ok( exists $INC{'Quux.pm'}, ' %INC sees Quux.pm' );
130 is( ref $INC{'Quux.pm'}, 'FooLoader',
131 ' val Quux.pm is an object in %INC' );
132 is( $INC{'Quux.pm'}, $href, ' val Quux.pm is correct in %INC' );
134 pop @INC;
137 push @INC, $aref;
142 ok( exists $INC{'Quux1.pm'}, ' %INC sees Quux1.pm' );
143 is( ref $INC{'Quux1.pm'}, 'FooLoader',
144 ' val Quux1.pm is an object in %INC' );
145 is( $INC{'Quux1.pm'}, $aref, ' val Quux1.pm is correct in %INC' );
147 pop @INC;
150 push @INC, $sref;
155 ok( exists $INC{'Quux2.pm'}, ' %INC sees Quux2.pm' );
156 is( ref $INC{'Quux2.pm'}, 'FooLoader',
157 ' val Quux2.pm is an object in %INC' );
158 is( $INC{'Quux2.pm'}, $sref, ' val Quux2.pm is correct in %INC' );
160 pop @INC;
162 push @INC, sub {
165 $INC{$filename} = 'xyz';
176 ok( exists $INC{'Toto.pm'}, ' %INC sees Toto.pm' );
177 ok( ! ref $INC{'Toto.pm'}, q/ val Toto.pm isn't a ref in %INC/ );
178 is( $INC{'Toto.pm'}, 'xyz', ' val Toto.pm is correct in %INC' );
180 pop @INC;
193 push @INC, bless {}, "AutoInc";
195 ok($evalret, "require Quux3 via AUTOLOADed INC");
196 ok(exists $INC{"Quux3.pm"}, "Quux3 in %INC");
197 is($autoloaded, "AutoInc::INC", "AUTOLOAD was called for INC");
199 pop @INC;
202 push @INC, sub {
218 #local @INC; # local fails on tied @INC
219 my @old_INC = @INC; # because local doesn't work on tied arrays
220 @INC = ('lib', 'lib/Devel', sub { $got = $_[1]; return undef; });
223 local %INC;
231 local %INC;
238 @INC = @old_INC;
251 unshift @INC, sub { PVBM };
256 shift @INC;
257 unshift @INC, sub { \PVBM };
262 shift @INC;
268 unshift @INC, sub { $die, $data };
282 shift @INC;
285 unshift @INC, sub { \(my $tmp = '$_ = "are temps freed prematurely?"') };
288 "are temps freed prematurely when returned from inc filters?";
289 shift @INC;
297 local @INC = @INC;
298 @INC = (\&fake_module)x2;
301 'require PADTMP passing freed var when @INC has multiple subs';
305 skip ("Not applicable when run from inccode-tie.t", 6) if tied @INC;
311 local @INC = undef;
312 my $t = tie $INC[0], 'INCtie';
315 delete $INC{'foo.pm'}; # in case another test uses foo
318 'FETCH is called once on undef scalar-tied @INC elem';
319 is $called, 1, 'sub in scalar-tied @INC elem is called';
320 () = "$INC[0]"; # force a fetch, so the SV is ROK
324 'FETCH is called once on scalar-tied @INC elem holding ref';
325 is $called, 2, 'sub in scalar-tied @INC elem holding ref is called';
330 'FETCH called once on scalar-tied @INC elem returning array';
335 'FETCH called once on scalar-tied @INC elem returning string';
343 pop @INC;
345 push @INC, sub {
351 $INC{$filename} = "/custom/path/to/$filename";
356 is( $INC{'Publius/Vergilius/Maro.pm'},
357 '/custom/path/to/Publius/Vergilius/Maro.pm', '%INC set correctly');
367 pop @INC;
374 push @INC, sub {
408 foreach (keys %INC) {
409 delete $INC{$_} if /^BBBLPLAST/;
421 fresh_perl_like('@INC=("A",bless({},"Hook"),"D"); '
424 qr/\(\@INC[\w ]+: A Hook=HASH\(0x[A-Fa-f0-9]+\) B C D\)/,