CPAN RT

use Gtk2 '1.023'; # require at least version 1.023 of the bindings
if ($Gtk2::VERSION >= 1.040 and Gtk2->CHECK_VERSION (2, 4, 0)) {
# the GtkFileChooser, new in gtk+ 2.4.0 and first supported in
# Gtk2-Perl at 1.040, is available
} else {
# GtkFileChooser is not available, fall back to GtkFileSelection
}

Since the Gtk2 Perl module is a bridge to an external library with its own versions and API revisions, we have three different versions available for inspection. Which one you need to use at which time depends entirely on the situation. Gtk2 uses the same scheme as Glib and the underlying gtk+ C library; that is, the standard $Gtk2::VERSION for the version of the bindings, all-caps (MAJOR|MINOR|MICRO)_VERSION functions for the bound version, and lower-case (major|minor|micro)_version functions for the runtime version. See Glib::version and http://developer.gnome.org/doc/API/2.0/gtk/gtk-Feature-Test-Macros.html for more information.

Note also that gtk_check_version() and GTK_CHECK_VERSION() have different semantics in C, and we have preserved those faithfully.

Note: this function will terminate your program if it is unable to initialize the gui for any reason. If you want your program to fall back to some other interface, you want to use Gtk2->init_check instead.

key_snooper_install returns an id that may be used with key_snooper_remove.

From gtk+'s API documentation:

You most likely don't want to use any of these functions; synthesizing events is rarely needed. Consider asking on the mailing list for better ways to achieve your goals. For example, use Gtk2::Gdk::invalidate_rect or Gtk2::Widget::queue_draw instead of making up expose events.