1N/Apackage PerlIO::via::QuotedPrint;
1N/A
1N/A# Set the version info
1N/A# Make sure we do things by the book from now on
1N/A
1N/A$VERSION = '0.06';
1N/Ause strict;
1N/A
1N/A# Make sure the encoding/decoding stuff is available
1N/A
1N/Ause MIME::QuotedPrint (); # no need to pollute this namespace
1N/A
1N/A# Satisfy -require-
1N/A
1N/A1;
1N/A
1N/A#-----------------------------------------------------------------------
1N/A# IN: 1 class to bless with
1N/A# 2 mode string (ignored)
1N/A# 3 file handle of PerlIO layer below (ignored)
1N/A# OUT: 1 blessed object
1N/A
1N/Asub PUSHED { bless \*PUSHED,$_[0] } #PUSHED
1N/A
1N/A#-----------------------------------------------------------------------
1N/A# IN: 1 instantiated object (ignored)
1N/A# 2 handle to read from
1N/A# OUT: 1 decoded string
1N/A
1N/Asub FILL {
1N/A
1N/A# Read the line from the handle
1N/A# Decode if there is something decode and return result or signal eof
1N/A
1N/A my $line = readline( $_[1] );
1N/A (defined $line) ? MIME::QuotedPrint::decode_qp( $line ) : undef;
1N/A} #FILL
1N/A
1N/A#-----------------------------------------------------------------------
1N/A# IN: 1 instantiated object (ignored)
1N/A# 2 buffer to be written
1N/A# 3 handle to write to
1N/A# OUT: 1 number of bytes written
1N/A
1N/Asub WRITE {
1N/A
1N/A# Encode whatever needs to be encoded and write to handle: indicate result
1N/A
1N/A (print {$_[2]} MIME::QuotedPrint::encode_qp($_[1])) ? length($_[1]) : -1;
1N/A} #WRITE
1N/A
1N/A__END__
1N/A
1N/A=head1 NAME
1N/A
1N/APerlIO::via::QuotedPrint - PerlIO layer for quoted-printable strings
1N/A
1N/A=head1 SYNOPSIS
1N/A
1N/A use PerlIO::via::QuotedPrint;
1N/A
1N/A open( my $in,'<:via(QuotedPrint)','file.qp' )
1N/A or die "Can't open file.qp for reading: $!\n";
1N/A
1N/A open( my $out,'>:via(QuotedPrint)','file.qp' )
1N/A or die "Can't open file.qp for writing: $!\n";
1N/A
1N/A=head1 DESCRIPTION
1N/A
1N/AThis module implements a PerlIO layer that works on files encoded in the
1N/Aquoted-printable format. It will decode from quoted-printable while reading
1N/Afrom a handle, and it will encode as quoted-printable while writing to a handle.
1N/A
1N/A=head1 REQUIRED MODULES
1N/A
1N/A MIME::QuotedPrint (any)
1N/A
1N/A=head1 SEE ALSO
1N/A
1N/AL<PerlIO::via>, L<MIME::QuotedPrint>, L<PerlIO::via::Base64>,
1N/AL<PerlIO::via::MD5>, L<PerlIO::via::StripHTML>, L<PerlIO::via::Rotate>.
1N/A
1N/A=head1 ACKNOWLEDGEMENTS
1N/A
1N/ABased on example that was initially added to MIME::QuotedPrint.pm for the
1N/A5.8.0 distribution of Perl.
1N/A
1N/A=head1 COPYRIGHT
1N/A
1N/ACopyright (c) 2002-2003 Elizabeth Mattijsen. All rights reserved. This
1N/Alibrary is free software; you can redistribute it and/or modify it under
1N/Athe same terms as Perl itself.
1N/A
1N/A=cut