GLib has a message logging mechanism which it uses for the g_return_if_fail() assertion macros, etc.; it's really versatile and allows you to set various levels to be fatal and whatnot. Libraries use these for various types of message reporting.
These functions let you reroute those messages from Perl. By default, the warning, critical, and message levels go through perl's warn(), and fatal ones go through croak(). [i'm not sure that these get to croak() before GLib abort()s on them...]
Route all g_logs for log_domain through gperl's log handling. You'll have to register domains in each binding submodule, because there's no way we can know about them down here.
And, technically, this traps all the predefined log levels, not any of the ones you (or your library) may define for yourself.
$log_func will be called as
&$log_func ($log_domain, $log_levels, $message, $user_data);
where $log_domain is the name requested and $log_levels is a Glib::LogLevelFlags of level and flags being reported.
&$log_func ($log_domain, $log_levels, $message, $user_data)
where $log_domain is a string, and $log_levels is a Glib::LogLevelFlags of level and flags being reported.
If log_func is \&Glib::Log::default_handler or undef then Glib's default handler is set.
The return value from set_default_handler is the previous handler. This is \&Glib::Log::default_handler for Glib's default, otherwise a Perl function previously installed. If the handler is some other non-Perl function then currently the return is undef, but perhaps that will change to some wrapped thing, except that without associated userdata there's very little which could be done with it (it couldn't be reinstalled later without its userdata).
set_default_handler
2 POD Errors
The following errors were encountered while parsing the POD:
Unknown directive: =arg
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.