NAME

Mail::Make::Stream::QuotedPrint - Streaming Quoted-Printable Encoder/Decoder for Mail::Make

SYNOPSIS

use Mail::Make::Stream::QuotedPrint;

my $s = Mail::Make::Stream::QuotedPrint->new ||
    die( Mail::Make::Stream::QuotedPrint->error, "\n" );

$s->encode( $input => $output, eol => "\015\012" ) ||
    die( $s->error );

$s->decode( $input => $output ) || die( $s->error );

use Mail::Make::Stream::QuotedPrint qw( encode_qp decode_qp );
encode_qp( $input => $output, eol => "\015\012" ) ||
    die( $Mail::Make::Stream::QuotedPrint::QuotedPrintError );

VERSION

v0.3.0

DESCRIPTION

RFC 2045 Quoted-Printable encoder and decoder. Both "encode" and "decode" operate as line-oriented stream pipelines: data is read from $from line by line (via getline()) and written to $to without accumulating the full content in memory. Suitable for large text parts backed by Mail::Make::Body::File.

Each of $from and $to may be:

  • A native filehandle or IO object

  • A scalar reference (\$scalar)

  • A plain string (file path)

METHODS

decode( $from, $to )

Reads QP-encoded data from $from line by line, decodes each line via MIME::QuotedPrint, and writes the raw bytes to $to. Returns $self on success, undef on error.

encode( $from, $to [, %opts] )

Reads raw data from $from line by line, encodes each line as Quoted-Printable, and writes the result to $to. Any Perl-internal UTF-8 representation is converted to raw UTF-8 bytes via "encode_utf8" in Encode before encoding. Returns $self on success, undef on error.

Options:

eol

Line ending appended after each encoded line. Defaults to CRLF ("\015\012").

CLASS FUNCTIONS

The following functions are exportable on request:

use Mail::Make::Stream::QuotedPrint qw( encode_qp decode_qp );

encode_qp( $from, $to [, %opts] )

Convenience wrapper for "encode". Sets $QuotedPrintError and returns undef on failure.

decode_qp( $from, $to )

Convenience wrapper for "decode". Sets $QuotedPrintError and returns undef on failure.

encode_qp_utf8( $str )

Encodes $str as UTF-8 bytes first, then as Quoted-Printable.

is_encoder_installed

is_decoder_installed

Return true if MIME::QuotedPrint is available.

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Mail::Make, Mail::Make::Entity, Mail::Make::Stream::Base64, Mail::Make::Stream, MIME::QuotedPrint

RFC 2045

COPYRIGHT & LICENSE

Copyright(c) 2026 DEGUEST Pte. Ltd.

All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.