Net::PSYC::Event - Event wrapper for various event systems.


Net-PSYC documentation  | view source Contained in the Net-PSYC distribution.

Index


NAME

Top

Net::PSYC::Event - Event wrapper for various event systems.

DESCRIPTION

Top

Net::PSYC::Event offers an interface to easily use Net::PSYC with different Event systems. It currently offers support for Event.pm, IO::Select and Gtk2.

SYNOPSIS

Top

    # load Net::PSYC::Event for Gtk2 eventing.
    use Net::PSYC qw(Event=Gtk2);
    use Net::PSYC::Event qw(register_uniform unregister_uniform start_loop);

    bind_uniform('psyc://example.org/');
    register_uniform('psyc://example.org/@chatroom');

    sub msg {
	my ($source, $mc, $data, $vars) = @_;
	# lets do some conferencing
    }

    start_loop() # start the event-loop

PERL API

Top

register_uniform( $unl[, $object ] )

Registers $object or the calling package for all incoming messages targeted at $unl. Calls

$object->msg( $source, $mc, $data, $vars ) or

caller()::msg( $source, $mc, $data, $vars )

for every incoming PSYC packet.

unregister_uniform( $unl )

Unregister an $unl. No more packages will be delivered for that $unl thenceforward.

start_loop()

Start the Event loop.

stop_loop()

Stop the Event loop.

add( $fd, $flags, $callback[, $repeat])

Start watching for events on $fd. $fd may be a GLOB or an IO::Handle object. $flags may be r, w or e (data to be read, written or pending exceptions) or any combination.

If $repeat is set to 0 the callback will only be called once (revoke() may be used to reactivate it). If you don't want one-shot events either leave $repeat out or set it to 1.

$id = add( $time, 't', $callback[, $repeat])

Add a timer event. The event will be triggered after $time seconds. This is a one-shot event by default. However, if $repeat is set to 1, $callback will be called every $time seconds until the event is removed.

One-shot timer events are removed automatically and revoke is not possible for them.

Remember: You are not using a real-time system. The accuracy of timer events depends heavily on other events pending, io-operations and system load in general.

remove( $fd[, $flags] )

Stop watching for events on $fd. Different types can not be removed seperately if they have been add()ed together!

remove( $id )

Removed the timer event associated with the given $id.

revoke( $fd )

Revokes the eventing for $fd. ( one-shot events )

SEE ALSO

Top

Net::PSYC, Net::PSYC::Client, Net::PSYC::Event::Event, Net::PSYC::Event::IO_Select, Net::PSYC::Event::Gtk2, http://psyc.pages.de/

AUTHORS

Top

Arne Gödeke <el@goodavice.pages.de>

COPYRIGHT

Top


Net-PSYC documentation  | view source Contained in the Net-PSYC distribution.