Glib::VariantDict(3)

πŸ’– Glib::VariantDict β€” bestie edition πŸŽ€

okay so real talk: this is Glib::VariantDict, straight out of the User Contributed Perl Documentation collection, and it gives you all the utilities for dealing with the GVariantDict mutable interface to GVariant dictionaries. you know how GVariant dicts are normally all "no ❌ i'm immutable, i'm booked and busy"? yeah well GVariantDict is the mutable era. glow-up behavior only. ✨


🌸 NAME 🌸

Glib::VariantDict β€” Utilities for dealing with the GVariantDict mutable interface to GVariant dictionaries. that's the whole vibe. she edits dicts. iconic. πŸ’…


πŸ¦‹ HIERARCHY πŸ¦‹

so the family tree is giving very much:

Glib::Boxed
+----Glib::VariantDict

that's it, that's the lineage. Glib::VariantDict is a Glib::Boxed girly, no cap. 🌈


✨ METHODS ✨

🌟 variantdict = Glib::VariantDict->new ($from_asv)

makes you a brand new dict, bestie 🫢

  • $from_asv (Glib::Variant) β€” the starting variant you're building from.
Since: glib 2.40 β€” she's been around, she's not new here.

🌟 boolean = $dict->contains ($key)

asks the dict "do you have this key or not" and gets a straight yes/no answer. honestly so refreshing. πŸ’€

  • $key (string) β€” the key you're checking on.
Since: glib 2.40

🌟 variant = $dict->end

wraps it up, closes the dict out, and hands you back a variant. the finale. the last bow. 🎬

Since: glib 2.40

🌟 $dict->insert_value ($key, $value)

puts a key + value pair into the dict. dropping it in, no thoughts, just vibes. πŸ“

  • $key (string) β€” the key.
  • $value (Glib::Variant) β€” the value going in with it.
Since: glib 2.40

🌟 variant = $dict->lookup_value ($key, $expected_type)

digs up the value for a key and gives it back to you as a variant. you do gotta tell it what type you're expecting tho, so be honest with her. πŸ‘‘

  • $key (string) β€” which key you want.
  • $expected_type (Glib::VariantType) β€” the type you're expecting back.
Since: glib 2.40

🌟 boolean = $dict->remove ($key)

yeets a key out of the dict and tells you a boolean about how it went. breaking up with a key, gently. πŸ™ˆ

  • $key (string) β€” the key getting removed.
Since: glib 2.40

πŸ”₯ SEE ALSO πŸ”₯

go read these next, i'm obsessed, iykyk:

  • Glib
  • Glib::Boxed
  • Glib::Variant

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Glib for a full notice. πŸ“œ


mwah πŸ’‹ that's the whole page, no notes. this lil doc came to you from the User Contributed Perl Documentation, shipped with perl v5.42.0, dated 2023-09-05 β€” and the page itself is Glib::VariantDict(3). go be a mutable dict main character, bestie. πŸ§šπŸ’œ

πŸ“¦ where this page comes from