File Coverage

blib/lib/PerlIO/via/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 PerlIO::via::QuotedPrint;
2              
3             $VERSION= '0.07';
4              
5             # be as strict as possible
6 1     1   21613 use strict;
  1         10  
  1         36  
7              
8             # modules that we need
9 1     1   833 use MIME::QuotedPrint (); # no need to pollute this namespace
  1         2274  
  1         154  
10              
11             # satisfy -require-
12             1;
13              
14             #-------------------------------------------------------------------------------
15             #
16             # Standard Perl features
17             #
18             #-------------------------------------------------------------------------------
19             # IN: 1 class to bless with
20             # 2 mode string (ignored)
21             # 3 file handle of PerlIO layer below (ignored)
22             # OUT: 1 blessed object
23              
24 2     2 0 2144 sub PUSHED { bless \*PUSHED,$_[0] } #PUSHED
25              
26             #-------------------------------------------------------------------------------
27             # IN: 1 instantiated object (ignored)
28             # 2 handle to read from
29             # OUT: 1 decoded string
30              
31             sub FILL {
32              
33             # decode and return
34 4     4 0 17 my $line= readline( $_[1] );
35 4 100       25 return ( defined $line )
36             ? MIME::QuotedPrint::decode_qp($line)
37             : undef;
38             } #FILL
39              
40             #-------------------------------------------------------------------------------
41             # IN: 1 instantiated object (ignored)
42             # 2 buffer to be written
43             # 3 handle to write to
44             # OUT: 1 number of bytes written
45              
46             sub WRITE {
47              
48             # encode and write to handle: indicate result
49 1 50   1   3 return ( print { $_[2] } MIME::QuotedPrint::encode_qp( $_[1] ) )
  1         32  
50             ? length( $_[1] )
51             : -1;
52             } #WRITE
53              
54             #-------------------------------------------------------------------------------
55              
56             __END__