Various useful utilities defined in Glib.xs.
call the boot code of a module by symbol rather than by name.
in a perl extension which uses several xs files but only one pm, you need to bootstrap the other xs files in order to get their functions exported to perl. if the file has MODULE = Foo::Bar, the boot symbol would be boot_Foo__Bar.
never use this function directly. see GPERL_CALL_BOOT.
GPERL_CALL_BOOT
for the curious, this calls a perl sub by function pointer rather than by name; call_sv requires that the xsub already be registered, but we need this to call a function which will register xsubs. this is an evil hack and should not be used outside of the GPERL_CALL_BOOT macro. it's implemented as a function to avoid code size bloat, and exported so that extension modules can pull the same trick.
Allocate and return a pointer to an nbytes-long, zero-initialized, temporary buffer that will be reaped at the next garbage collection sweep. This is handy for allocating things that need to be alloc'ed before a croak (since croak doesn't return and give you the chance to free them). The trick is that the memory is allocated in a mortal perl scalar. See the perl online manual for notes on using this technique.
Do not under any circumstances attempt to call g_free(), free(), or any other deallocator on this pointer, or you will crash the interpreter.
Return a localized version of the filename in the sv, using g_filename_from_utf8 (and consequently this function might croak). The memory is allocated using gperl_alloc_temp.
Convert the filename into an utf8 string as used by gtk/glib and perl.
Compare a pair of ascii strings, considering '-' and '_' to be equivalent. Used for things like enum value nicknames and signal names.
Like g_str_hash(), but considers '-' and '_' to be equivalent.
Creates a new Perl argv object whose members can then be passed to functions that request argc and argv style arguments.
If the called function(s) modified argv, you can call gperl_argv_update to update Perl's @ARGV in the same way.
Remember to call gperl_argv_free when you're done.
Updates @ARGV to resemble the stored argv array.
Frees any resources associated with pargv.
Formats the variable stored in sv for output in error messages. Like SvPV_nolen(), but ellipsizes real strings (i.e., not stringified references) at 20 chars to trim things down for error messages.
Checks the SV sv for definedness just like Perl's defined() would do. Most importantly, it correctly handles "magical" SVs, unlike bare SvOK. It's also NULL-safe.
Tries to store sv in hv. Decreases sv's reference count if something goes wrong.
To install Glib, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Glib
CPAN shell
perl -MCPAN -e shell install Glib
For more information on module installation, please visit the detailed CPAN module installation guide.