From: Jarkko Hietaniemi Date: Sun, 5 Aug 2001 16:10:59 +0000 (+0000) Subject: Add a test for PerlIO::Via. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2b8740d823413f94180ffcaa10364510759dbab1;p=p5sagit%2Fp5-mst-13.2.git Add a test for PerlIO::Via. p4raw-id: //depot/perl@11582 --- diff --git a/MANIFEST b/MANIFEST index 8f46b10..19bd6a2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -434,8 +434,9 @@ ext/PerlIO/PerlIO.t See if PerlIO works ext/PerlIO/Scalar/Makefile.PL PerlIO layer for scalars ext/PerlIO/Scalar/Scalar.pm PerlIO layer for scalars ext/PerlIO/Scalar/Scalar.xs PerlIO layer for scalars -ext/PerlIO/t/encoding.t See if PerlIo encoding conversion works -ext/PerlIO/t/scalar.t Test of PerlIO::Scalar +ext/PerlIO/t/encoding.t See if PerlIO encoding conversion works +ext/PerlIO/t/scalar.t See if PerlIO::Scalar works +ext/PerlIO/t/via.t See if PerlIO::Via works ext/PerlIO/Via/Makefile.PL PerlIO layer for layers in perl ext/PerlIO/Via/Via.pm PerlIO layer for layers in perl ext/PerlIO/Via/Via.xs PerlIO layer for layers in perl diff --git a/ext/PerlIO/Via/Via.pm b/ext/PerlIO/Via/Via.pm index 1f5dedd..2c73289 100644 --- a/ext/PerlIO/Via/Via.pm +++ b/ext/PerlIO/Via/Via.pm @@ -22,8 +22,13 @@ following methods. In the method descriptions below I<$fh> will be a reference to a glob which can be treated as a perl file handle. It refers to the layer below. I<$fh> is not passed if the layer is at the bottom of the stack, for this reason and to maintain -some level of "compatibility" with TIEHANDLE classes it is passed -last. +some level of "compatibility" with TIEHANDLE classes it is passed last. + +As an example, in Perl release 5.8.0 the MIME::QuotedPrint module +defines the required TIEHANDLE methods so that you can say + + use MIME::QuotedPrint; + open(my $fh, ">Via(MIME::QuotedPrint)", "qp"); =over 4 diff --git a/ext/PerlIO/t/via.t b/ext/PerlIO/t/via.t new file mode 100644 index 0000000..a2201e0 --- /dev/null +++ b/ext/PerlIO/t/via.t @@ -0,0 +1,33 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + unless (find PerlIO::Layer 'perlio') { + print "1..0 # Skip: not perlio\n"; + exit 0; + } +} + +my $tmp = "via$$"; + +print "1..3\n"; + +$a = join("", map { chr } 0..255) x 10; + +use MIME::QuotedPrint; +open(my $fh,">Via(MIME::QuotedPrint)", $tmp); +print $fh $a; +close($fh); +print "ok 1\n"; + +open(my $fh," } +close($fh); +print "ok 2\n"; + +print "ok 3\n" if $a eq $b; + +END { + 1 while unlink $tmp; +}