Glib 1.132 review

by on

Glib are Perl wrappers for the GLib utility and Object libraries. SYNOPSIS use Glib; ABSTRACT This module provides perl

License: GPL (GNU General Public License)
File size: 0K
Developer: muppet and the gtk2-perl team
0 stars award from

Glib are Perl wrappers for the GLib utility and Object libraries.


use Glib;


This module provides perl access to GLib and GLib's GObject libraries. GLib is a portability and utility library; GObject provides a generic type system with inheritance and a powerful signal system. Together these libraries are used as the foundation for many of the libraries that make up the Gnome environment, and are used in many unrelated projects.

This wrapper attempts to provide a perlish interface while remaining as true as possible to the underlying C API, so that any reference materials you can find on using GLib may still apply to using the libraries from perl. This module also provides facilities for creating wrappers for other GObject-based libraries. The "SEE ALSO" section contains pointers to all sorts of good information.


GLib provides to C programs many of the same facilities Perl offers natively. Where GLib's functionality overlaps Perl's, Perl's is favored. Some concepts have been eliminated entirely, as Perl is a higher-level language than C. In other instances we've had to add or change APIs to make sense in Perl. Here's a quick run-down:

Perl Already Does That

The GLib types GList (a doubly-linked list), GSList (singly-linked list), GHashTable, GArray, etc have all been replaced by native Perl datatypes. In fact, many functions which take GLists or arrays simply accept lists on the Perl stack. For the most part, GIOChannels are no more functional than Perl file handles, so you won't see any GIOChannels. GClosures are not visible at the Perl level, because Perl code references do the same thing. Just about any function taking either a C function pointer or a GClosure will accept a code reference in Perl. (In fact, you can probably get away with just a subroutine name in many spots, provided you aren't using strict subs.)

Don't Worry About That

Some concepts have been eliminated; you need never worry about reference-counting on GObjects or having to free GBoxed structures. Perl is a garbage-collected language, and we've put a lot of work into making the bindings take care of memory for you in a way that feels natural to a Perl developer. You won't see GValues in Perl (that's just a C structure with Perl scalar envy, anyway).


Glib 1.132 keywords