having to go into the nitty gritty of programming C with XS as the interface
to Perl.
-One example module, L<PerlIO::via::QuotedPrint>, is include with Perl
+One example module, L<PerlIO::via::QuotedPrint>, is included with Perl
5.8.0, and more example modules are available from CPAN, such as
L<PerlIO::via::StripHTML> and L<PerlIO::via::Base64>. The
PerlIO::via::StripHTML for instance, allows you to say:
package PerlIO::via::QuotedPrint;
-# Make sure we do things by the book
# Set the version info
+# Make sure we do things by the book from now on
+$VERSION = '0.04';
use strict;
-$PerlIO::via::QuotedPrint::VERSION = 0.01;
# Make sure the encoding/decoding stuff is available
use MIME::QuotedPrint (); # no need to pollute this namespace
+# Satisfy -require-
+
+1;
+
#-----------------------------------------------------------------------
# IN: 1 class to bless with
# 2 mode string (ignored)
# 3 file handle of PerlIO layer below (ignored)
# OUT: 1 blessed object
-sub PUSHED { bless [],$_[0] } #PUSHED
+sub PUSHED { bless \*PUSHED,$_[0] } #PUSHED
#-----------------------------------------------------------------------
# IN: 1 instantiated object (ignored)
(print {$_[2]} MIME::QuotedPrint::encode_qp($_[1])) ? length($_[1]) : -1;
} #WRITE
-# Satisfy -require-
-
-1;
-
__END__
=head1 NAME
use PerlIO::via::QuotedPrint;
- open( my $in,'<Via(PerlIO::via::QuotedPrint)','file.qp' )
+ open( my $in,'<:via(QuotedPrint)','file.qp' )
or die "Can't open file.qp for reading: $!\n";
- open( my $out,'>Via(PerlIO::via::QuotedPrint)','file.qp' )
+ open( my $out,'>:via(QuotedPrint)','file.qp' )
or die "Can't open file.qp for writing: $!\n";
=head1 DESCRIPTION
=head1 SEE ALSO
-L<PerlIO::via>, L<MIME::QuotedPrint>, L<PerlIO::via::Base64>, L<PerlIO::via::MD5>,
-L<PerlIO::via::StripHTML>.
+L<PerlIO::via>, L<MIME::QuotedPrint>, L<PerlIO::via::Base64>,
+L<PerlIO::via::MD5>, L<PerlIO::via::StripHTML>, L<PerlIO::via::Rotate>.
=head1 COPYRIGHT
of a C<PerlIO::via> class:
use PerlIO::via::QuotedPrint;
- open($fh,">Via(PerlIO::via::QuotedPrint)",$path);
+ open($fh,">:via(QuotedPrint)",$path);
This will automatically convert everything output to C<$fh> to
Quoted-Printable. See L<PerlIO::via> and L<PerlIO::via::QuotedPrint>.
open( $fh, "<:encoding(iso-8859-7)", $pathname );
-=item ":Scalar"
+=item ":scalar"
Provides support for reading data from and writing data to a scalar.
- open( $fh, ":Scalar", \$scalar );
+ open( $fh, "+<:scalar", \$scalar );
When a handle is so opened, then reads get bytes from the string value
of I<$scalar>, and writes change the value. In both cases the position
in I<$scalar> starts as zero but can be altered via C<seek>, and
determined via C<tell>.
-=item ":Via"
+Please note that this layer is implied when calling open() thus:
+
+ open( $fh, "+<", \$scalar );
+
+=item ":via"
Provided to allow layers to be implemented as Perl code. For instance:
use PerlIO::via::StripHTML;
- open( my $fh, ">:Via(StripHTML)", "index.html" );
+ open( my $fh, "<:via(StripHTML)", "index.html" );
See L<PerlIO::via> for details.