Glib::Variant - strongly typed value datatype
my $v = Glib::Variant->new (as, [GTK+, Perl]); my $aref = $v->get (as);
There are two sets of APIs for creating and dealing with
Glib::Variant
s: the low-level API described below under
METHODS, and the convenience API described in this section.
Constructs a variant from $format_string
and
$value
. Also supports constructing multiple variants when
the format string is a concatenation of multiple types.
Deconstructs $variant
according to
$format_string
.
The following symbols are currently supported in format strings:
+------------------------------+---------------------------------+ | Symbol | Meaning | +------------------------------+---------------------------------+ | b, y, n, q, i, u, x, t, h, d | Boolean, byte and numeric types | | s, o, g | String types | | v | Variant types | | a | Arrays | | m | Maybe types | | () | Tuples | | {} | Dictionary entries | +------------------------------+---------------------------------+
Note that if a format string specifies an array, a tuple or a
dictionary entry (a, () or {}), then array references are expected by
new
and produced by get
. For arrays of
dictionary entries (a{}), hash references are also supported by
new
and handled as you would expect.
For a complete specification, see the documentation at
Glib::Variant
$child_type
(Glib::VariantType)
$children
(scalar)
$value
(boolean)
$value
(Glib::UChar)
$string
(byte string)
Since: glib 2.26
$key
(Glib::Variant)
$value
(Glib::Variant)
$value
(double)
$value
(integer)
$value
(integer)
$value
(integer)
$value
(64 bit integer)
$child_type
(Glib::VariantType)
$child
(Glib::Variant)
$object_path
(string)
$signature
(string)
$string
(string)
$children
(scalar)
$value
(unsigned)
$value
(unsigned)
$value
(64 bit unsigned)
$value
(Glib::Variant)
Since: glib 2.26
$index_
(unsigned)
$two
(Glib::Variant)
Since: glib 2.26
$two
(Glib::Variant)
$type
(Glib::VariantType)
$key
(string)
$expected_type
(Glib::VariantType)
Since: glib 2.28
$type
(Glib::VariantType)
$text
(string)
May croak with a Glib::Error in $@ on failure.
$type_annotate
(boolean)
Glib, Glib::VariantType, Glib::VariantDict
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See Glib for a full notice.