Sprog::GlibEventLoop.3pm

Langue: en

Version: 2005-06-26 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

Sprog::GlibEventLoop - methods used to interface Sprog to the Glib event loop

SYNOPSIS

   my $event_loop = $factory->load_class('/app/eventloop');
 
   $event_loop->add_idle_handler(sub { $event_loop->quit });
 
   $event_loop->run;
 
 

DESCRIPTION

This class uses Glib to provide an event loop that does not require Gtk or a graphical display.

The Sprog application uses Sprog::GtkEventLoop which uses this class as a base but overrides the "run()" and "quit()" methods to link into the Gtk event loop rather than the lower level Glib event loop.

This class is used during testing by test scripts that don't require a display. It is also used by Sprog in "--nogui" mode (see Command-line options).

METHODS

run ( )

Enter the main loop.

quit ( )

Exit the main loop.

add_timeout ( delay, sub_ref )

Define a callback that should be called after a specified delay (milliseconds).

add_idle_handler ( sub_ref )

Define a callback that should be called when no other events are waiting.

add_io_reader ( fh, sub_ref )

Define a callback that should be called when the specified file is ready for reading.

add_io_writer ( fh, sub_ref )

Define a callback that should be called when the specified file is ready for writing. Copyright 2004-2005 Grant McLean <grantm@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.