| 1 | # Copyright (C) 2002-2004, 2012 Elizabeth Mattijsen. All rights reserved. | ||||||||||
| 2 | # Copyright (C) 2015 Steve Hay. All rights reserved. | ||||||||||
| 3 | |||||||||||
| 4 | # This module is free software; you can redistribute it and/or modify it under | ||||||||||
| 5 | # the same terms as Perl itself, i.e. under the terms of either the GNU General | ||||||||||
| 6 | # Public License or the Artistic License, as specified in the F<LICENCE> file. | ||||||||||
| 7 | |||||||||||
| 8 | package PerlIO::via::QuotedPrint; | ||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use 5.008001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | # be as strict as possible | ||||||||||
| 13 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 1 | our $VERSION = '0.10'; | |||||||||
| 16 | |||||||||||
| 17 | # modules that we need | ||||||||||
| 18 | 1 | ▶ | use MIME::QuotedPrint (); # no need to pollute this namespace | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | |||||||||||
| 20 | # satisfy -require- | ||||||||||
| 21 | 1 | 1; | |||||||||
| 22 | |||||||||||
| 23 | #------------------------------------------------------------------------------- | ||||||||||
| 24 | # | ||||||||||
| 25 | # Standard Perl features | ||||||||||
| 26 | # | ||||||||||
| 27 | #------------------------------------------------------------------------------- | ||||||||||
| 28 | # IN: 1 class to bless with | ||||||||||
| 29 | # 2 mode string (ignored) | ||||||||||
| 30 | # 3 file handle of PerlIO layer below (ignored) | ||||||||||
| 31 | # OUT: 1 blessed object | ||||||||||
| 32 | |||||||||||
| 33 | 2 | ▶ | sub PUSHED { bless \*PUSHED,$_[0] } #PUSHED | ||||||||
|
Subroutine
PUSHED: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 34 | |||||||||||
| 35 | #------------------------------------------------------------------------------- | ||||||||||
| 36 | # IN: 1 instantiated object (ignored) | ||||||||||
| 37 | # 2 handle to read from | ||||||||||
| 38 | # OUT: 1 decoded string | ||||||||||
| 39 | |||||||||||
| 40 | 4 | ▶ | sub FILL { | ||||||||
|
Subroutine
FILL: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 41 | |||||||||||
| 42 | # decode and return | ||||||||||
| 43 | 4 | my $line= readline( $_[1] ); | |||||||||
| 44 | 4 | ▶ | return ( defined $line ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | ? MIME::QuotedPrint::decode_qp($line) | ||||||||||
| 46 | : undef; | ||||||||||
| 47 | } #FILL | ||||||||||
| 48 | |||||||||||
| 49 | #------------------------------------------------------------------------------- | ||||||||||
| 50 | # IN: 1 instantiated object (ignored) | ||||||||||
| 51 | # 2 buffer to be written | ||||||||||
| 52 | # 3 handle to write to | ||||||||||
| 53 | # OUT: 1 number of bytes written | ||||||||||
| 54 | |||||||||||
| 55 | 1 | ▶ | sub WRITE { | ||||||||
|
Subroutine
WRITE: called CC=2 SCAR=7.2
| |||||||||||
| 56 | |||||||||||
| 57 | # encode and write to handle: indicate result | ||||||||||
| 58 | 1 | ▶ | return ( print { $_[2] } MIME::QuotedPrint::encode_qp( $_[1] ) ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | ? length( $_[1] ) | ||||||||||
| 60 | : -1; | ||||||||||
| 61 | } #WRITE | ||||||||||
| 62 | |||||||||||
| 63 | #------------------------------------------------------------------------------- | ||||||||||
| 64 | |||||||||||
| 65 | __END__ | ||||||||||