Graphi...ntList(3pm)

πŸ“¦
version 0.67 Β· 2 versions
  • 0.67 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.67 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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 a remove_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. returns undef if 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 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