File Coverage

blib/lib/IOLayer/QuotedPrint.pm
Criterion Covered Total %
statement 11 11 100.0
branch 3 4 75.0
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 19 22 86.3


line stmt bran cond sub pod time code
1             package IOLayer::QuotedPrint;
2              
3             # Make sure we do things by the book
4             # Set the version info
5              
6 1     1   57462 use strict;
  1         2  
  1         32  
7             $IOLayer::QuotedPrint::VERSION = 0.05;
8              
9             # Make sure the encoding/decoding stuff is available
10              
11 1     1   420 use MIME::QuotedPrint (); # no need to pollute this namespace
  1         1103  
  1         106  
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     2 0 1180 sub PUSHED { bless [],$_[0] } #PUSHED
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     4 0 22 my $line = readline( $_[1] );
30 4 100       29 (defined $line) ? MIME::QuotedPrint::decode_qp( $line ) : undef;
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 50   1   466 (print {$_[2]} MIME::QuotedPrint::encode_qp($_[1])) ? length($_[1]) : -1;
  1         19  
42             } #WRITE
43              
44             # Satisfy -require-
45              
46             1;
47              
48             __END__