Graphi...ntList(3pm)
π Graphi...ntList(3pm) β aka Graphics::Primitive::ComponentList π
okay bestie, this is the manual page for Graphics::Primitive::ComponentList, and it's giving User Contributed Perl Documentation energy. pull up a chair, grab a boba, we're learning about component lists together and it's gonna be adorable. π§β¨
πΈ NAME πΈ
Graphics::Primitive::ComponentList β it's a List of Components. that's the whole name. short, sweet, iconic. π
π¦ DESCRIPTION π¦
So basically this thing maintains a list of components and their constraints. that's its whole job, and it does it well. π
and here's the tea: it's implemented as a class instead of just being a plain array, specifically so it can do functionality above and beyond a simple array. no cap. a regular array could never. π
β¨ SYNOPSIS β¨
here's the vibe, literally just two lines of code and you're already main character:
my $c = Graphics::Primitive::ComponentList->new;
$c->add_component($comp, $constraint);
my $cindex = $c->find_component($comp->name);
see? slay. π
π«Ά METHODS π«Ά
π Constructor
newβ creates a new Container. fresh start, clean slate, new era. β¨
π Instance Methods
add_component ($component, $constraint)β adds a component to the list. returns a true value if the component was added successfully. a second argument may be required, so please consult the POD for your specific layout manager implementation β fr fr, go check, don't guess. π
and before the component actually gets added, it's passed to the validate_component method. if validate_component does not return a true value, then the component is not added. it's a whole vibe check and some components simply do not pass. π
clearβ reset components and constraints to empty arrayrefs. it's giving factory reset. πΈcomponent_countβ returns the number of components in this list. math girlie behavior. π’constraint_countβ returns the number of constraints in this list. also math, also girlie. β¨eachβ calls the supplied CODEREF for each component in this list, passing the component and it's constraints as arguments. π
my $flist = $list->each(
sub{
my ($component, $constraint) = @_; $comp->class('foo)
}
);
findβ returns a new ComponentList containing only the components for which the supplied CODEREF returns true. the coderef is called for each component and is passed the component and it's constraints. undefined components (the ones left around after aremove_component) are automatically skipped β we don't see them, they don't exist. π
my $flist = $list->find(
sub{
my ($component, $constraint) = @_; return $comp->class eq 'foo'
}
);
and if no matching components are found, a new list is still returned, so that simple calls like $container->find(...)->each(...) don't explode. π₯β‘οΈπ safety first, bestie.
find_componentβ returns the index of the first component with the supplied name. returnsundefif no component with that name is found. if it's not there, it's not there. periodt. πget_componentβ get the component at the specified index. πget_constraintβ get the constraint at the specified index. πβ¨remove_componentβ removes a component and it's constraint. components must have names to be removed β no name, no removal, that's the rule. returns an arrayref of Components that were removed. bye bye, we'll miss you. π¦
π AUTHOR π
Copyright 2008-2009 by Cory G Watson. respect the icon who built this. π«Ά
π BUGS π
please report any bugs or feature requests to bug-geometry-primitive at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Geometry-Primitive.
ngl this part is kind of cute β I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. it's a whole group chat situation, mutual updates, we love to see it. ππ
π COPYRIGHT & LICENSE π
Copyright 2008-2009 by Cory G Watson.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
and that's the whole page, bestie!! π this one came from the perl v5.34.0 era, dated 2022-06-14, and it lives in the User Contributed Perl Documentation section β so when you cite it, that's the origin story. go forth and manage your components, you absolute legend. π β¨π¦ππ
π¦ where this page comes from
- debian bookworm: libgraphics-primitive-perl 0.67-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libgraphics-primitive-perl 0.67-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libgraphics-primitive-perl 0.67-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgraphics-primitive-perl 0.67-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgraphics-primitive-perl 0.67-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms