NAME

UniEvent::Streamer::Input - Pure Perl Input stream bridge

DESCRIPTION

This is pure perl input stream, meant to be assigned with UniEvent::Streamer. It is assumed, that some external source will generate data and eof event, and via the UniEvent::Streamer::Input it will be fed into UniEvent::Streamer.

For example, it can read a file, encrypt it and conduct it further to TCP output stream.

It is derived from UniEvent::Streamer::IInput.

METHODS

new()

Constructs new pupe perl input stream.

start($loop)

This method is invoked upon underlying UniEvent::Streamer start. Executed once per Streamer/Input lifetime.

stop()

This method is invoked upon underlying UniEvent::Streamer stop. Executed once per Streamer/Input lifetime. No any further I/O is expected.

start_reading()

This method is invoked when underlying UniEvent::Streamer asks to start reading. Can be executed multiple times during the object lifetime.

It is assumed, that handle_read/handle_eof will be invoked in future.

stop_reading()

This method is invoked when underlying UniEvent::Streamer asks to stop reading. Can be executed multiple times during the object lifetime.

handle_read/handle_eof must not be invoked after the method been called.

handle_read($data [, $error_code = undef])

Data consumption method, which must be invoked to feed incoming $data with possible $error_code to stop UniEvent::Streamer. By the implementation the data is forwarded either to internal buffer of the assigned streamer or directly to the output stream.

In the case of error the streamer will stop.

handle_eof()

Let the assigned streamer know, that no more data is available from the input.

REFERENCES

UniEvent::Streamer

UniEvent::Streamer::IInput