GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Glib::Variant(3) User Contributed Perl Documentation Glib::Variant(3)

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.

variant = Glib::Variant->new ($format_string, $value)
(variant1, ...) = Glib::Variant->new ($format_string, $value1, ...)
Constructs a variant from $format_string and $value. Also supports constructing multiple variants when the format string is a concatenation of multiple types.
value = $variant->get ($format_string)
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

<https://developer.gnome.org/glib/stable/glib-GVariantType.html>
<https://developer.gnome.org/glib/stable/glib-GVariant.html>
<https://developer.gnome.org/glib/stable/gvariant-format-strings.html>
<https://developer.gnome.org/glib/stable/gvariant-text.html>

  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.

2022-04-12 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.