Config...:HashId(3pm)

πŸ’– Config::Model::HashId β€” the perl manpage, but make it cute ✨

okay bestie, gather round, because we're talking about Config::Model::HashId from the User Contributed Perl Documentation. She handles hash elements for your configuration model, and honestly? she's giving main character energy. πŸ’…


🌸 NAME 🌸

Config::Model::HashId β€” Handle hash element for configuration model 🫢


⭐ VERSION ⭐

version 2.166 β€” that's the one, no cap.


πŸŽ€ SYNOPSIS πŸŽ€

literally just go read the synopsis in Config::Model::AnyId, bestie. that's where the goods are:

See "SYNOPSIS" in Config::Model::AnyId

πŸ¦‹ DESCRIPTION πŸ¦‹

so this class provides hash elements for a Config::Model::Node. that's the whole vibe. ✨

and the hash index? she can be an enumerated type, a boolean, an integer, or a string. options, queen. πŸ‘‘


πŸ’œ CONSTRUCTOR πŸ’œ

HashId objects should NOT be created directly. please. i am begging. do not do it yourself. πŸ™ˆ

🌈 Hash model declaration 🌈

head over to the model declaration section of Config::Model::AnyId β€” that's the blueprint, that's the assignment. πŸ““

✨ Methods ✨

πŸ“ get_type

Returns "hash". that's it. that's the whole personality. iconic.

πŸ“ fetch_size

Returns the number of elements of the hash. counting era fr fr. πŸ”’

πŸ“ sort

Sorts an ordered hash. and if you call it on a non ordered hash? it throws an error. read her. πŸ’€

πŸ“ insort

Parameters: key

Creates a new element in the ordered hash while keeping the keys in alphabetical order. so tidy, so organized, we love a structured queen. πŸ‘‘

Returns the newly created element. 🎁

Throws an error if you call it on a non ordered hash. nope, not today.

πŸ“ firstkey

Returns the first key of the hash. Behaves like the each core perl function. classic behavior, no surprises. πŸ’–

πŸ“ nextkey

Returns the next key of the hash. Behaves like the each core perl function. same energy, next in line. ✨

πŸ“ swap

Parameters: ( key1 , key2 )

Swaps the order of the 2 keys. and if the hash isn't ordered? it's just ignored. we move on. πŸ’…

πŸ“ move

Parameters: ( key1 , key2 )

Renames key1 in key2. glow-up for a key, honestly. ✨

There's also an optional check parameter to disable the warning:

move ('foo','bar', check => 'no')

πŸ“ move_after

Parameters: ( key_to_move [ , after_this_key ] )

Moves the first key after the second one. If the second parameter is omitted, the first key gets placed in first position instead. Ignored for non ordered hash. πŸ”€

πŸ“ move_up

Parameters: ( key )

Moves the key up in an ordered hash. Attempting to move up the first key of an ordered hash is ignored β€” she's already at the top, bestie, she cannot go higher. 🌟 Ignored for non ordered hash.

πŸ“ move_down

Parameters: ( key )

Moves the key down in an ordered hash. Attempting to move up the last key of an ordered hash is ignored (yes, it says "move up" there, that's the note as written πŸ™ˆ). Ignored for non ordered hash.

πŸ“ load_data

Parameters: ( data => ( hash_ref | array_ref ) [ , check => ... , ... ])

Loads data as a hash ref for a standard hash. πŸ’–

For an ordered hash, you should load it with an array ref, or with a hash containing a special "__order" element. like, e.g. loaded with either:

[ a => 'foo', b => 'bar' ]

or

{ __order => ['a','b'], b => 'bar', a => 'foo' }

and if the loading order truly doesn't matter to you? there's a "__skip_order" parameter:

{ __skip_order => 1, b => 'bar', a => 'foo'}

load_data can also be called with a single ref parameter. 🫢

Returns 1 if some data was loaded.

πŸ“ get_info

Returns a list of information related to the hash. more deets over at "get_info" in Config::Model::Value. go look, iykyk. πŸ”₯


πŸ‘‘ AUTHOR πŸ‘‘

Dominique Dumont, (ddumont at cpan dot org)


🌈 SEE ALSO 🌈

  • Config::Model
  • Config::Model::Instance
  • Config::Model::AnyId
  • Config::Model::ListId
  • Config::Model::Value

πŸ’– AUTHOR πŸ’–

Dominique Dumont β€” yes again, she wrote it, she's the moment, periodt.


This software is Copyright (c) 2005-2022 by Dominique Dumont.

This is free software, licensed under:

The GNU Lesser General Public License, Version 2.1, February 1999

and that's the whole thing, bestie!! πŸŒΈπŸ¦‹βœ¨ this page came from the User Contributed Perl Documentation, shipped with perl v5.42.3, dated 2026-07-23. slay, ate, no crumbs left. πŸ’…πŸŽ€πŸ’œ

πŸ“¦ where this page comes from