NAME

Glib::Object::Introspection - Dynamically create Perl language bindings

SYNOPSIS

use Glib::Object::Introspection;
Glib::Object::Introspection->setup(
  basename => 'Gtk',
  version => '3.0',
  package => 'Gtk3');
# now GtkWindow, to mention just one example, is available as
# Gtk3::Window, and you can call gtk_window_new as Gtk3::Window->new

ABSTRACT

Glib::Object::Introspection uses the gobject-introspection and libffi projects to dynamically create Perl bindings for a wide variety of libraries. Examples include gtk+, webkit, libsoup and many more.

DESCRIPTION

To allow Glib::Object::Introspection to create bindings for a library, it must have installed a typelib file, for example $prefix/lib/girepository-1.0/Gtk-3.0.typelib. In your code you then simply call Glib::Object::Introspection->setup to set everything up. This method takes a couple of key-value pairs as arguments. These three are mandatory:

basename => $basename

The basename of the library that should be wrapped. If your typelib is called Gtk-3.0.typelib, then the basename is 'Gtk'.

version => $version

The particular version of the library that should be wrapped, in string form. For Gtk-3.0.typelib, it is '3.0'.

package => $package

The name of the Perl package where every class and method of the library should be rooted. If a library with basename 'Gtk' contains an object 'GtkWindow', and you pick as the package 'Gtk3', then that object will be available as 'Gtk3::Window'.

The rest are optional:

search_path => $search_path

A path that should be used when looking for typelibs. If you use typelibs from system directories, or if your environment is set up correctly, then this should not be necessary.

name_corrections => { auto_name => new_name, ... }

A hash ref that is used to rename functions and methods. Use this if you don't like the automatically generated mapping for a function or method. For example, if g_file_hash is automatically represented as Glib::IO::file_hash but you want Glib::IO::File::hash then pass

name_corrections => {
  'Glib::IO::file_hash' => 'Glib::IO::File::hash'
}
class_static_methods => [ functions1, ... ]

An array ref of function names that you want to be treated as class-static methods. That is, if you want be able to call Gtk3::Window::list_toplevels as Gtk3::Window->list_toplevels, then pass

class_static_methods => [
  'Gtk3::Window::list_toplevels'
]

The function names refer to those after name corrections.

SEE ALSO

gobject-introspection: http://live.gnome.org/GObjectIntrospection
libffi: http://sourceware.org/libffi/

AUTHORS

Emmanuele Bassi <ebassi at linux intel com>
muppet <scott asofyet org>
Torsten Schönfeld <kaffeetisch at gmx de>

LICENSE

This library is free software; you can redistribute it and/or modify it under the terms of the Lesser General Public License (LGPL). For more information, see http://www.fsf.org/licenses/lgpl.txt