Change 11582 by jhi@alpha on 2001/08/05 16:10:59
Add a test for PerlIO::Via.
Affected files ...
... //depot/perl/MANIFEST#513 edit
... //depot/perl/ext/PerlIO/Via/Via.pm#4 edit
... //depot/perl/ext/PerlIO/t/via.t#1 add
Differences ...
==== //depot/perl/MANIFEST#513 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST.~1~ Sun Aug 5 10:15:05 2001
+++ perl/MANIFEST Sun Aug 5 10:15:05 2001
@@ -434,8 +434,9 @@
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
==== //depot/perl/ext/PerlIO/Via/Via.pm#4 (text) ====
Index: perl/ext/PerlIO/Via/Via.pm
--- perl/ext/PerlIO/Via/Via.pm.~1~ Sun Aug 5 10:15:05 2001
+++ perl/ext/PerlIO/Via/Via.pm Sun Aug 5 10:15:05 2001
@@ -22,8 +22,13 @@
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
==== //depot/perl/ext/PerlIO/t/via.t#1 (text) ====
Index: perl/ext/PerlIO/t/via.t
--- perl/ext/PerlIO/t/via.t.~1~ Sun Aug 5 10:15:05 2001
+++ perl/ext/PerlIO/t/via.t Sun Aug 5 10:15:05 2001
@@ -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,"<Via(MIME::QuotedPrint)", $tmp);
+{ local $/; $b = <$fh> }
+close($fh);
+print "ok 2\n";
+
+print "ok 3\n" if $a eq $b;
+
+END {
+ 1 while unlink $tmp;
+}
End of Patch.