3 # Tests for the source filters in coderef-in-@INC
8 unless (find PerlIO::Layer 'perlio') {
9 print "1..0 # Skip: not perlio\n";
19 no warnings 'uninitialized';
20 ref $_[1] eq 'ARRAY' ? @{$_[1]} : $_[1];
25 open $fh, "<", \'pass("Can return file handles from \@INC");';
28 my @origlines = ("# This is a blank line\n",
29 "pass('Can return generators from \@INC');\n",
30 "pass('Which return multiple lines');\n",
33 my @lines = @origlines;
36 # Return of 0 marks EOF
37 return defined $_ ? 1 : 0;
43 # Check that the array dereferencing works ready for the more complex tests:
48 is (ref $param, 'ARRAY', "Got our parameter");
50 return defined $_ ? 1 : 0;
51 }, ["pass('Can return generators which take state');\n",
52 "pass('And return multiple lines');\n",
56 open $fh, "<", \'fail("File handles and filters work from \@INC");';
58 do [$fh, sub {s/fail/pass/}];
60 open $fh, "<", \'fail("File handles and filters with state work from \@INC");';
62 do [$fh, sub {s/$_[1]/pass/}, 'fail'];