Config...:Warper(3pm)
π Config::Model::Warper β the perl manpage, but make it cute β¨
okay bestie, welcome to the User Contributed Perl Documentation for Config::Model::Warper π
this one is short but it's powerful, and it lives at Config...:Warper(3pm) iykyk π
πΈ NAME πΈ
Config::Model::Warper β Warp tree properties π
β¨ VERSION β¨
version 2.166 π
π¦ SYNOPSIS π¦
# internal class
yep that's the whole thing. it's an internal class, no cap. it does its thing behind the scenes π
π DESCRIPTION π
okay so here's the tea: depending on the value of a warp master (which is, fr fr, a Config::Model::Value or a Config::Model::CheckList object), this class changes the properties of:
- a node β
Config::Model::WarpedNode - a hash β
Config::Model::HashId - a list β
Config::Model::ListId - a checklist β
Config::Model::CheckList - or another value π
π§ Warper and warped π§
Warping an object means that the properties of the object get changed depending on the value of another object. that's it, that's the vibe β¨
- the changed object? that's the warped object π
- the other object that holds the important value? that's the warp master, aka the warper object π
and bestie, you can also set up several warp masters for one single warped object π«Ά that means the properties of the warped object get changed according to a combination of the values of the warp masters. iconic.
π Warp arguments π
Warp arguments are passed in a hash ref whose keys are follow and and rules:
π Warp follow argument π
Grab string leading to the Config::Model::Value or Config::Model::CheckList warp master. E.g.:
follow => '! tree_macro'
In case of several warp master, follow is a hash of named parameters. The values are several grab strings:
follow => { m1 => '! macro1', m2 => '- macro2' }
π Note: By designfollowargument of warper module is a plain path to keep warp mechanism (relatively) simple.followargument ofConfig::Model::ValueComputerhas more features and is documented there.
π Warp rules argument π
rules argument is a list of hash refs that specify the warped object property changes. These rules specifies the actual property changes for the warped object depending on the value(s) of the warp master(s).
Use named parameters and a boolean expression to specify the effect. The first match is applied. In this case, rules is an array ref:
follow => { m => '! macro1' } ,
rules => [
{ when => '$m eq "A"' , apply => { <effect for macro1 == A> } },
{ when => '$m eq "B" or $m eq"C "' , apply => { <effect for macro1 == B|C> } }
]
In case of several warp masters, follow must use several named parameters:
follow => { m1 => '! macro1', m2 => '- macro2' } ,
rules => [
{ when => '$m1 eq "A" && $m2 eq "C"', apply => { <effect for A C> } },
{ when => '$m1 eq "A" && $m2 eq "D"', apply => { <effect for A D> } },
{ when => '$m1 eq "B" && $m2 eq "C"', apply => { <effect for B C> } },
{ when => '$m1 eq "B" && $m2 eq "D"', apply => { <effect for B D> } },
]
Of course some combinations of warp master values can have the same effect:
follow => { m1 => '! macro1', m2 => '- macro2' } ,
rules => [
{ when => '$m1 eq "A" && $m2 eq "C"', apply => { <effect X> } },
{ when => '$m1 eq "A" && $m2 eq "D"', apply => { <effect Y> } },
{ when => '$m1 eq "B" && $m2 eq "C"', apply => { <effect Y> } },
{ when => '$m1 eq "B" && $m2 eq "D"', apply => { <effect Y> } },
]
In this case, you can use different boolean expressions to save typing:
follow => { m1 => '! macro1', m2 => '- macro2' } ,
rules => [
{ when => '$m1 eq "A" && $m2 eq "C"', apply => { <effect X> } },
{ when => '$m1 eq "A" && $m2 eq "D"', apply => { <effect Y> } },
{ when => '$m1 eq "B" && ( $m2 eq "C" or $m2 eq "D") ', apply => { <effect Y> } },
]
Note that the boolean expression is sanitized and used in a Perl eval, so you can use most Perl syntax and regular expressions π₯
Functions (like &foo) are called like $self->foo before evaluation of the boolean expression. noted bestie βοΈ
The rules must be declared with a slightly different way when a check_list is used as a warp master: a check_list has not a simple value. The rule must check whether a value is checked or not amongs all the possible items of a check list. (that typo is the original's, we don't fix it, we respect it π«‘)
For example, let's say that $cl in the rule below point to a check list whose items are "A" and "B". The rule must verify if the item is set or not:
rules => [
{ when => '$cl.is_set(A)', apply => { <effect when A is set> } },
{ when => '$cl.is_set(B)', apply => { <effect when B is set> } },
# can be combined
{ when => '$cl.is_set(B) and $cl.is_set(A)', apply => { <effect when A and B are set> } },
],
With this feature, you can control with a check list whether some element must be shown or not (assuming FooClass and BarClass classes are declared):
element => [
# warp master
my_check_list => {
type => 'check_list',
choice => ['has_foo','has_bar']
},
# controlled element that show up only when has_foo is set
foo => {
type => 'warped_node',
level => 'hidden',
config_class_name => 'FooClass',
follow => {
selected => '- my_check_list'
},
rules => [
{
when => '$selected.is_set(has_foo)',
apply => { level => 'normal' }
}
]
},
# controlled element that show up only when has_bar is set
bar => {
type => 'warped_node',
level => 'hidden',
config_class_name => 'BarClass',
follow => {
selected => '- my_check_list'
},
rules => [
{
when => '$selected.is_set(has_bar)',
apply => { level => 'normal' }
}
]
}
]
look at that glow-up π¦ full example, nothing skipped, we ate.
π Methods π
π
warp_error π
This method returns a string describing:
- The location(s) of the warp master π
- The current value(s) of the warp master(s) π
- The other values accepted by the warp master that can be tried (if the warp master is an enumerated type) π―
π How does this work ? π
π Registration π
- When a warped object is created, the constructor registers to the warp masters. The warp master are found by using the special string passed to the
followparameter. As explained in grab method, the string provides the location of the warp master in the configuration tree using a symbolic form. - Then the warped object retrieve the value(s) of the warp master(s)
- Then the warped object warps itself using the above value(s). Depending on these value(s), the properties of the warped object are modified.
π₯ Master update π₯
- When a warp master value is updated, the warp master calls all its warped object and pass them the new master value.
- Then each warped object modifies properties according to the new warp master value.
like... the communication?? the reciprocity?? main character energy fr fr π
πΈ AUTHOR πΈ
Dominique Dumont, (ddumont at cpan dot org) π
π¦ SEE ALSO π¦
Config::Model::AnyThingConfig::Model::HashIdConfig::Model::ListIdConfig::Model::WarpedNodeConfig::Model::Value
go read those next, bestie, they're the whole friend group π«Ά
π AUTHOR π
Dominique Dumont π
π COPYRIGHT AND LICENSE π
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
okay that's the whole page, you read it, you understood it, you're literally a warper expert now π
this was perl v5.42.3, dated 2026-07-23, from Config...:Warper(3pm) β mwah, go warp some trees, ily π©·β¨
π¦ where this page comes from
- ubuntu stonking: libconfig-model-perl 2.166-1 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms