Sebastiano Piccoli > Asynchat-0.01 > Asynchat

Download:
Asynchat-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Asynchat - used as base class of Asyncore to simplify to handle protocols

SYNOPSIS ^

    use base qw( Asynchat );
    
    my $channel = Subclass->new($addr, $port);
    
    $channel->handle_connect( ... )
    $channel->collect_incoming_data( ... );
    $channel->found_terminator( ... )

DESCRIPTION ^

Asynchat builds on Asyncore, simplifying asynchronous clients and servers and making it easier to handle protocols whose elements are terminated by arbitrary strings, or are of variable length.

Asyncore is a basic infrastructure for asyncronous socket programming. It provides an implementation of "reactive socket" and it provides hooks for handling events. Code must be written into these hooks (handlers).

Asynchat is intended as an abstract class. Override collect_incoming_data() and found_terminator() in a subclass to provide the implementation of the protocol you are writing.

See the folder <i>script</i> for a complete example on the correct use of this module.

METHODS ^

collect_incoming_data($data)

set_terminator($string)

get_terminator()

found_terminator()

push_direct($data)

push_with_producer($data)

close_when_done()

ACKNOWLEDGEMENTS ^

This module is a porting of asynchat.py written in python.

LICENCE ^

LGPL

syntax highlighting: