NAME

Mail::Colander::Server::IOWrapper

SYNOPSIS

use Mail::Colander::Server::IOWrapper;

DESCRIPTION

Wrapper for bridging the I/O between Mojolicious and Net::Server::Mail::ESMTP. This module is not meant to be used directly.

INTERFACE

Constructor

new

my $wrapper = Mail::Colander::Server::IOWrapper->new(stream => $stream);

Create an instance. $stream is a required Mojo::IOLoop::Stream object.

Accessors

inr

my $ref_to_scalar = $wrapper->inr;

Reference to the input buffer. Data that arrives via "read_input" is mostly sent along, except for some few bytes that might be kept until something "complete" is available for parsing, much in the spirit of "Net::Server::Mail::process".

ofh

my $filehandle = $wrapper->ofh;

A filehandle that can be used by Net::Server::Mail::ESMTP for sending responses. Puts data in an internal buffer (see "outr") for later forwarding.

There is a dirty trick that blesses this filehandle into IO::Handle, to make Net::Server::Mail::ESMTP happy. It does not make me happy though.

outr

my $ref_to_scalar = $wrapper->outr;

Reference to the output buffer. Data printed to "ofh" ends up here and are eventually sent along to the stream via "write_output".

size

my $size = $wrapper->size;
$wrapper->size(1000);

Track the size of the data transferred so far.

stream

my $stream = $wrapper->stream;

Get the Mojo::IOLoop::Stream object that handles the actual data trasnfer with the peer.

Methods

read_input

my $some_bytes = $wrapper->read_input($input_bytes);

Returns data much like what "Net::Server::Mail::process" does.

reset

$wrapper->reset;

Clear buffers and reset the output filehandle.

reset_size

$wrapper->reset_size;

Set "size" back to 0.

write_output

$wrapper->write_output;

Flush the output buffer towards the "stream".

ANYTHING ELSE (INCLUDING AUTHOR, COPYRIGHT AND LICENSE)

See documentation for Mail::Colander.