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