NAME
App::Chart::Glib::Ex::MoreUtils -- more Glib utility functions
SYNOPSIS
use App::Chart::Glib::Ex::MoreUtils;
FUNCTIONS
App::Chart::Glib::Ex::MoreUtils::ref_weak ($obj)-
Return a reference to a weak reference to
$obj. This is good for the "userdata" in signal connections etc when you want some weakening so you don't keep$objalive forever due to the connection. For example,$model->signal_connect (row_deleted, \&deleted_handler, App::Chart::Glib::Ex::MoreUtils::ref_weak($self)); sub deleted_handler { my ($model, $path, $ref_weak_self) = @_; my $self = $$ref_weak_self || return; ... } App::Chart::Glib::Ex::MoreUtils::lang_select ($lang => $value, ...)-
Choose a value according to the user's preferred language. Each
$langargument is a two-letter language code like "en". The$valuearguments are any scalars to return. For exampleApp::Chart::Glib::Ex::MoreUtils::lang_select (de => 'deutsch', en => 'english') # returns either 'deutsch' or 'english'The user's preferred language is taken from
Glib::get_language_names(see Glib::Utils). If none of the given$langvalues are among the user's preferences then the first in the call is used as the default and its$valuereturned.This is meant for selecting semi-technical things from a fixed set of possibilities within the program code, for example different URLs for the English or German version of some web page which will be parsed. If it was in a .mo file (per
Locale::TextDomain) the choice would be locked down by the translator, butlang_selectallows a user preference.