Gnome2::GConf::Client is a commodity class based on GObject used to access the default GConfEngine provided by the GConf daemon. It has a cache, finer-grained notification of changes and a default error handling mechanism.
GObject
GConfEngine
In C, each fallible function has a GError optional argument: by setting it to a valid GError structure, the function will fill it in case of error; by passing a NULL value, the function will silently fail.
GError
In Perl, each fallible method has a boolean check_error argument; by setting this argument to TRUE, the method will croak con failure, otherwise it will silently fail.
check_error
TRUE
NOTE: To retain backward compatibility, the default behaviour is to check each error; that is, the check_error argument silently is set to TRUE.
In order to catch an error, you might use eval as a try...catch equivalent:
eval { $s = $client->get_string($some_key); 1; }; if (Glib::Error::matches($@, 'Gnome2::GConf::Error', 'bad-key')) { # recover from a bad-key error. }
On failure, if the error is unchecked, the unreturned_error signal will be fired by the Gnome2::GConf::Client object; the error signal will always be fired, whether the error is checked or not.
unreturned_error
error
If you want to let the global error handler function catch just the unchecked error, use the Gnome2::GConf::Client::set_error_handling method, and attach a callback to the unreturned_error signal:
Gnome2::GConf::Client::set_error_handling
$client->set_error_handling('handle-unreturned'); $client->signal_connect(unreturned_error => sub { my ($client, $error) = @_; warn $error; # is a Glib::Error });
This method returns an array containing all the directories in a given directory.
You should not use this method. This method emits the "error" signal.
You should not use this method. This method emits the "unreturned-error" signal.
You should not use this method. This method emits the "value-changed" signal.
Commit a given Gnome2::GConf::ChangeSet. In scalar context, or if $remove_committed is FALSE, return a boolean value; otherwise, return the boolean value and the Gnome2::GConf::ChangeSet $cs, pruned of the successfully committed changes.
Create a Gnome2::GConf::ChangeSet from a list of keys inside the GConf database.
To install Gnome2::GConf, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gnome2::GConf
CPAN shell
perl -MCPAN -e shell install Gnome2::GConf
For more information on module installation, please visit the detailed CPAN module installation guide.