Boucherot::SetOfConnections - A set of ``Connections'' for boucherot
use Boucherot::SetOfConnections; my $soc=new Boucherot::SetOfConnections;
# ...
$soc->start;
# Start never end.
This is the class that wait for all the networks events or for the timers.
This class is a subset of Boucherot.
class Boucherot::SetOfConnections
Attributs:
-$ instance : Boucherot::SetOfConnections
+ timeout : SCALAR + handler : Boucherot::Handler
- connections_by_socket : { IO::Socket => { 'code' => Code, 'mid' => SCALAR, }, ... } : Hash - connections : { mid1 => { 'mid' => SCALAR, 'time' => SCALAR, 'connected' => Boolean, 'socket' => IO::Socket, 'context' => SCALAR, }, ... } : Hash - context : { context1 => mid1, ... } : Hash - next_context_id : SCALAR - queue : { qid1 : Scalar => [ time : Scalar , method : CODE , instance : Boucherot::Connection, @arguments : Array ], ... } - qid : SCALAR - error : IO::Select - read : IO::Select - write : IO::Select
Methods:
+$ new () : Boucherot::SetOfConnections
Read
+ get_instance () : Boucherot::SetOfConnections + set_of_connections () : Boucherot::SetOfConnections + get_connection ( context : SCALAR ) : Boucherot::Connection + get_unused_context () : SCALAR
Write
+ addconn ( conn : Boucherot::Connection ) : + removeconn ( conn : Boucherot::Connection ) : + queue ( time : Scalar, method : CODE, instance : Boucherot::Connection, arguments : Array ) + schedule ( arguments : HASH )
Action
+ do_one_loop () : + start () :
- addfh ( fh : IO::Handle, code : CODE, flag : Scalar, obj : Boucherot::Connection) : - removefh ( fh : IO::Handle ) :
- update_register ( conn : Boucherot::Connection ) : - update_unregister ( conn : Boucherot::Connection ) : - clean_mid ( mid : SCALAR ) :
+$ new () : Boucherot::SetOfConnections
Constructor. It takes no arguments, and return an empty set of connections.
+ get_instance () : Boucherot::SetOfConnections
Return the current instance.
+ set_of_connections () : Boucherot::SetOfConnections
Acces the the set of connections for that instance, that is... itself. In fact, each connection has a parent, that must implement such a method. The must be another Connection or a SetOfConnections, so the SetOfConnections must implement such a method.
+ get_connection ( context : SCALAR ) : Boucherot::Connection
Get the connection from the context.
+ get_unused_context () : SCALAR
Get a random unused context for connections that haven't got one.
+ addconn ( conn : Boucherot::Connection ) :
Add a connection into the set of connections.
+ removeconn ( conn : Boucherot::Connection ) :
Remove a connection from the set of connections.
+ queue ( time : Scalar, method : CODE, instance : Boucherot::Connection, arguments : Array )
Add a new event into the events' queue.
+ schedule ( arguments : HASH )
Add a new event into the events' queue.
arguments can be:
time
: When to start the action (MUST BE PRESENT)
object
: The object (MUST BE PRESENT)
connection
: The related connection (may be the same as object
)
action
: A method name or a CODE (MUST BE PRESENT)
args
: Args to pass to the method (MUST BE PRESENT)
timer
: The timer period
+ do_one_loop () :
Wait for a network event or a timer event or a timeout, that is the internal timeout. That method is called in a loop into the start method.
+ start () :
Start the execution. It calls in a loop the method ``do_one_loop''.
XXX
- addfh ( fh : IO::Handle, code : CODE, flag : Scalar, obj : Boucherot::Connection) :
Add a new filehandle into the set of connections.
- removefh ( fh : IO::Handle ) :
Remove a filehandle from the set of connections.
- update_register ( conn : Boucherot::Connection ) :
Update all the internal attribut in relation with the new connection conn.
- update_unregister ( conn : Boucherot::Connection ) :
Update all the internal attribut in relation with the old connection conn.
- clean_mid ( mid : SCALAR ) :
Clean all the attributes related with mid, because mid doesn't reference anything now.
This class was written by Arthibus Gissehel <gissehel@vachefolle.com> in 2000.
This use some Net::IRC
that has it's own authors, see Net::IRC
Copyrights and NOTES section.
Boucherot::SetOfConnections is closed to Net::IRC
In fact, this class was a child of Net::IRC. But, for many reasons, it's now an independant project. Note that a lot code is ``Copyright (c) 1997 Greg Bacon & Dennis Taylor. All rights reserved.''
Note also that the Net::IRC's license (same as perl itself) also apply to Boucherot::SetOfConnections (see COPYING)