source: for-distributions/trunk/bin/windows/perl/lib/PerlIO/via/QuotedPrint.pm@ 14489

Last change on this file since 14489 was 14489, checked in by oranfry, 17 years ago

upgrading to perl 5.8

File size: 2.4 KB
Line 
1package PerlIO::via::QuotedPrint;
2
3# Set the version info
4# Make sure we do things by the book from now on
5
6$VERSION = '0.06';
7use strict;
8
9# Make sure the encoding/decoding stuff is available
10
11use MIME::QuotedPrint (); # no need to pollute this namespace
12
13# Satisfy -require-
14
151;
16
17#-----------------------------------------------------------------------
18# IN: 1 class to bless with
19# 2 mode string (ignored)
20# 3 file handle of PerlIO layer below (ignored)
21# OUT: 1 blessed object
22
23sub PUSHED { bless \*PUSHED,$_[0] } #PUSHED
24
25#-----------------------------------------------------------------------
26# IN: 1 instantiated object (ignored)
27# 2 handle to read from
28# OUT: 1 decoded string
29
30sub FILL {
31
32# Read the line from the handle
33# Decode if there is something decode and return result or signal eof
34
35 my $line = readline( $_[1] );
36 (defined $line) ? MIME::QuotedPrint::decode_qp( $line ) : undef;
37} #FILL
38
39#-----------------------------------------------------------------------
40# IN: 1 instantiated object (ignored)
41# 2 buffer to be written
42# 3 handle to write to
43# OUT: 1 number of bytes written
44
45sub WRITE {
46
47# Encode whatever needs to be encoded and write to handle: indicate result
48
49 (print {$_[2]} MIME::QuotedPrint::encode_qp($_[1])) ? length($_[1]) : -1;
50} #WRITE
51
52__END__
53
54=head1 NAME
55
56PerlIO::via::QuotedPrint - PerlIO layer for quoted-printable strings
57
58=head1 SYNOPSIS
59
60 use PerlIO::via::QuotedPrint;
61
62 open( my $in,'<:via(QuotedPrint)','file.qp' )
63 or die "Can't open file.qp for reading: $!\n";
64
65 open( my $out,'>:via(QuotedPrint)','file.qp' )
66 or die "Can't open file.qp for writing: $!\n";
67
68=head1 DESCRIPTION
69
70This module implements a PerlIO layer that works on files encoded in the
71quoted-printable format. It will decode from quoted-printable while reading
72from a handle, and it will encode as quoted-printable while writing to a handle.
73
74=head1 REQUIRED MODULES
75
76 MIME::QuotedPrint (any)
77
78=head1 SEE ALSO
79
80L<PerlIO::via>, L<MIME::QuotedPrint>, L<PerlIO::via::Base64>,
81L<PerlIO::via::MD5>, L<PerlIO::via::StripHTML>, L<PerlIO::via::Rotate>.
82
83=head1 ACKNOWLEDGEMENTS
84
85Based on example that was initially added to MIME::QuotedPrint.pm for the
865.8.0 distribution of Perl.
87
88=head1 COPYRIGHT
89
90Copyright (c) 2002-2003 Elizabeth Mattijsen. All rights reserved. This
91library is free software; you can redistribute it and/or modify it under
92the same terms as Perl itself.
93
94=cut
Note: See TracBrowser for help on using the repository browser.