| 1 | package SPVM::MIME::QuotedPrint; | ||
| 2 | |||
| 3 | 1; | ||
| 4 | |||
| 5 | =head1 Name | ||
| 6 | |||
| 7 | SPVM::MIME::QuotedPrint - Quoted-Printable Encoding/Decoding | ||
| 8 | |||
| 9 | =head1 Description | ||
| 10 | |||
| 11 | MIME::QuotedPrint class in L<SPVM> provides for Quoted-Printable encoding/decoding. | ||
| 12 | |||
| 13 | =head1 Usage | ||
| 14 | |||
| 15 | use MIME::QuotedPrint; | ||
| 16 | |||
| 17 | my $encoded = MIME::QuotedPrint->encode_qp($decoded); | ||
| 18 | my $decoded = MIME::QuotedPrint->decode_qp($encoded); | ||
| 19 | |||
| 20 | =head1 Class Methods | ||
| 21 | |||
| 22 | =head2 encode_qp | ||
| 23 | |||
| 24 | C<static method encode_qp : string ($string : string, $eol : string = undef, $binmode : int = 0);> | ||
| 25 | |||
| 26 | Returns an Quoted-Printable encoded version of the string $string. | ||
| 27 | |||
| 28 | The second argument $eol is the line-ending sequence to use. It is | ||
| 29 | optional and defaults to C<\n>. | ||
| 30 | |||
| 31 | Every occurrence of C<\n> is replaced | ||
| 32 | with this string, and it is also used for additional "soft line | ||
| 33 | breaks" to ensure that no line end up longer than 76 characters. | ||
| 34 | |||
| 35 | Pass it as C<\015\012> to produce data suitable for external consumption. | ||
| 36 | The string C<\r\n> produces the same result on many platforms, but not | ||
| 37 | all. | ||
| 38 | |||
| 39 | The third argument $binmode will select binary mode if passed as a | ||
| 40 | TRUE value. In binary mode C<\n> will be encoded in the same way as | ||
| 41 | any other non-printable character. | ||
| 42 | |||
| 43 | This ensures that a decoder will | ||
| 44 | end up with exactly the same string whatever line ending sequence it | ||
| 45 | uses. | ||
| 46 | |||
| 47 | An $eol of "" (the empty string) is special. In this case, no "soft | ||
| 48 | line breaks" are introduced and binary mode is effectively enabled so | ||
| 49 | that any C<\n> in the original data is encoded as well. | ||
| 50 | |||
| 51 | Exceptions: | ||
| 52 | |||
| 53 | $string must be defined. Otherwise an exception is thrown. | ||
| 54 | |||
| 55 | =head2 decode_qp | ||
| 56 | |||
| 57 | C<static method decode_qp : string ($string : string);> | ||
| 58 | |||
| 59 | Returns the plain text version of the Quoted-Printable string $string. | ||
| 60 | |||
| 61 | The lines of the result are C<\n> terminated, even if | ||
| 62 | the $string argument contains C<\r\n> terminated lines. | ||
| 63 | |||
| 64 | Exceptions: | ||
| 65 | |||
| 66 | $string must be defined. Otherwise an exception is thrown. | ||
| 67 | |||
| 68 | =head1 Distribution Containing This Class | ||
| 69 | |||
| 70 | L<SPVM::MIME::Base64> | ||
| 71 | |||
| 72 | =head1 Other Modules in This Distribution | ||
| 73 | |||
| 74 | =over 2 | ||
| 75 | |||
| 76 | =item * L<SPVM::MIME::QuotedPrint> | ||
| 77 | |||
| 78 | =back | ||
| 79 | |||
| 80 | =head1 See Also | ||
| 81 | |||
| 82 | =over 2 | ||
| 83 | |||
| 84 | =item * L<MIME::QuotedPrint> - SPVM::MIME::QuotedPrint is a MIME::QuotedPrint porting to SPVM | ||
| 85 | |||
| 86 | =back | ||
| 87 | |||
| 88 | =head1 Author | ||
| 89 | |||
| 90 | Yuki Kimoto (kimoto.yuki@gmail.com) | ||
| 91 | |||
| 92 | =head1 Copyright & License | ||
| 93 | |||
| 94 | Copyright (c) 2023 Yuki Kimoto | ||
| 95 | |||
| 96 | MIT License | ||
| 97 |