Config...:ListId(3pm)

πŸ’– Config::ListId β€” the list-element glow-up for your config model πŸ’–

okay bestie, so this is a Perl manual page, section 3pm, and it's literally all about Config::ListId β€” the class that handles list elements for a Config::Model config. Buckle up, it's cute and it's useful. πŸŽ€


✨ NAME ✨

Config::Model::ListId β€” handles the list element for a configuration model. that's it, that's the whole job πŸ’…


🌸 VERSION 🌸

version 2.166 β€” periodt, that's the one we're working with.


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so like, don't come here looking for the whole rundown, because the actual synopsis lives elsewhere:

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

go read that one, bestie, it's the main character of the synopsis situation πŸ‘‘


πŸ’œ DESCRIPTION πŸ’œ

This class provides list elements for a Config::Model::Node. That's the vibe. It's the thing that makes listy config values behave. Slay. ✨


🌈 CONSTRUCTOR 🌈

do NOT create a ListId object yourself. literally just don't. it should never be created directly, no cap. πŸ™ˆ

πŸ“ List model declaration πŸ“

for how you actually declare this in a model, head over to the model declaration section of Config::Model::AnyId. that's where the tea is β˜•

🌟 Methods 🌟

πŸ’… get_type

Returns "list". iconic. short. perfect.

πŸ’… fetch_size

Returns the number of elements of the list. it's giving "how many things are in here" energy πŸ”’

πŸ’… load

Parameters: (string, [ check => 'no' ] )

Store a set of values passed as a comma separated list of values. Values can be quoted strings β€” like for real, i.e "a,a",b yields ('a,a', 'b').

"check" can be yes, no or skip. pick your fighter ✨

πŸ’… store_set

Store a set of values (passed as list).

If tinkering with check is required, use the following way :

store_set ( \@v , check => 'skip' );

πŸ’… move

Parameters: ( from_index, to_index, [ check => 'no' )

Move an element within the list. "check" can be 'yes', 'no', 'skip'. scoot over, bestie πŸ›Ό

πŸ’… push

Parameters: ( value1, [ value2 ... ] )

push some values at the end of the list.

πŸ’… push_x

Parameters: ( values => [ v1','v2', ...] , ... )

Like push with extended options. Options are:

  • check β€” Check value validaty. Either "yes" (default), "no", "skip"
  • values β€” Values to push (array_ref)
  • value β€” Single value to push
  • annotation β€” (no description given in the original, so like… it's there, and that's all we know 🫢)

πŸ’… unshift

Parameters: ( value1, [ value2 ... ] )

unshift some values at the end of the list.

πŸ’… insert_at

Parameters: ( idx, value1, [ value2 ... ] )

unshift some values at index idx in the list.

πŸ’… insert_before

Parameters: ( ( val | qr/stuff/ ) , value1, [ value2 ... ] )

unshift some values before value equal to val or before value matching stuff.

πŸ’… insort

Parameters: ( value1, [ value2 ... ] )

Insert zz value on xxx list so that existing alphanumeric order is preserved.

⚠️ insort yields unpexpected results when called on an unsorted list. bestie. do not. sorted lists only or chaos ensues 😭

πŸ’… store

Equivalent to push_x. This method is provided to help write configuration parser, so the call is the same when dealing with leaf or list values. Prefer "push_x" when practical.

  • check β€” "yes", "no" or "skip"
  • annotation β€” list ref of annotation to store with the list values

Example:

$elt->push_x (
   values => [ 'v1','v2' ] ,
   annotation => [ 'v1 comment', 'v2 comment' ],
   check => 'skip'
);

πŸ’… sort

Sort the content of the list. Can only be called on list of leaf. leaf lists only, bestie, don't try it anywhere else 🌿

πŸ’… swap

Parameters: ( ida , idb )

Swap 2 elements within the array. tradesies πŸ”„

πŸ’… remove

Parameters: ( idx )

Remove an element from the list. Equivalent to splice @list,$idx,1. bye bye element πŸ‘‹

πŸ’… load_data

Parameters: ( data => ( ref | scalar ) [, check => ... ] [ , split_reg => $re ] )

Clear and load list from data contained in the data array ref. If a scalar or a hash ref is passed, the list is cleared and the data is stored in the first element of the list. If split_reg is specified, the scalar is split to load the array.

For instance

$elt->load_data( data => 'foo,bar', split_reg => qr(,) ) ;

loads [ 'foo','bar'] in $elt. boom, loaded, slay πŸ’₯

πŸ’… sort_algorithm

Returns a sub used to sort the list elements. See "sort" in perlfunc. Used only for list of leaves. This method can be overridden to alter sort order. custom sort vibes, if that's your thing πŸŽ€

πŸ’… get_info

Returns a list of information related to the list. See "get_info" in Config::Model::Value for more details. the info is over there, bestie πŸ”


πŸ‘‘ AUTHOR πŸ‘‘

Dominique Dumont, (ddumont at cpan dot org)


🌸 SEE ALSO 🌸

  • Config::Model::Model
  • Config::Model::Instance
  • Config::Model::AnyId
  • Config::Model::HashId
  • Config::Model::Value

go read those too, the whole squad is iconic πŸ’–


πŸ‘‘ AUTHOR (again, yes, for real) πŸ‘‘

Dominique Dumont


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 page, bestie 🫢 written against perl v5.42.3, dated 2026-07-23, in section 3pm of the Perl docs. go forth and list responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from