| 1 | package IOLayer::QuotedPrint; | ||||||||||
| 2 | |||||||||||
| 3 | # Make sure we do things by the book | ||||||||||
| 4 | # Set the version info | ||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | $IOLayer::QuotedPrint::VERSION = 0.05; | |||||||||
| 8 | |||||||||||
| 9 | # Make sure the encoding/decoding stuff is available | ||||||||||
| 10 | |||||||||||
| 11 | 1 | ▶ | use MIME::QuotedPrint (); # no need to pollute this namespace | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | #----------------------------------------------------------------------- | ||||||||||
| 14 | # IN: 1 class to bless with | ||||||||||
| 15 | # 2 mode string (ignored) | ||||||||||
| 16 | # 3 file handle of PerlIO layer below (ignored) | ||||||||||
| 17 | # OUT: 1 blessed object | ||||||||||
| 18 | |||||||||||
| 19 | 2 | ▶ | sub PUSHED { bless [],$_[0] } #PUSHED | ||||||||
|
Subroutine
PUSHED: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 20 | |||||||||||
| 21 | #----------------------------------------------------------------------- | ||||||||||
| 22 | # IN: 1 instantiated object (ignored) | ||||||||||
| 23 | # 2 handle to read from | ||||||||||
| 24 | # OUT: 1 decoded string | ||||||||||
| 25 | |||||||||||
| 26 | sub FILL { | ||||||||||
| 27 | # Read the line from the handle | ||||||||||
| 28 | # Decode if there is something decode and return result or signal eof | ||||||||||
| 29 | 4 | ▶ | my $line = readline( $_[1] ); | ||||||||
|
Subroutine
FILL: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 30 | 4 | ▶ | (defined $line) ? MIME::QuotedPrint::decode_qp( $line ) : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | } #FILL | ||||||||||
| 32 | |||||||||||
| 33 | #----------------------------------------------------------------------- | ||||||||||
| 34 | # IN: 1 instantiated object (ignored) | ||||||||||
| 35 | # 2 buffer to be written | ||||||||||
| 36 | # 3 handle to write to | ||||||||||
| 37 | # OUT: 1 number of bytes written | ||||||||||
| 38 | |||||||||||
| 39 | sub WRITE { | ||||||||||
| 40 | # Encode whatever needs to be encoded and write to handle: indicate result | ||||||||||
| 41 | 1 | ▶ | (print {$_[2]} MIME::QuotedPrint::encode_qp($_[1])) ? length($_[1]) : -1; | ||||||||
|
Subroutine
WRITE: called CC=2 SCAR=7.2
Branch: 1 branch
| |||||||||||
| 42 | } #WRITE | ||||||||||
| 43 | |||||||||||
| 44 | # Satisfy -require- | ||||||||||
| 45 | |||||||||||
| 46 | 1 | 1; | |||||||||
| 47 | |||||||||||
| 48 | __END__ | ||||||||||