HTML::...entGlob(3pm)

πŸ’… NAME πŸ’…

HTML::ElementGlob β€” a Perl extension for managing HTML::Element based objects as a single object. yes bestie, a glob, a lil squad of elements that move as one 🫢


✨ SYNOPSIS ✨

  use HTML::ElementGlob;
  $element_a = new HTML::Element 'font', color => 'red';
  $element_b = new HTML::Element 'font', color => 'blue';
  $element_a->push_content('red');
  $element_b->push_content('blue');

  $p = new HTML::Element 'p';
  $p->push_content($element_a, ' and ', $element_b, ' boo hoo hoo');

  # Tag type of the glob is not really relevant unless
  # you plan on seeing the glob as_HTML()
  $eglob = new HTML::ElementGlob 'p';
  $eglob->glob_push_content($element_a, $element_b);
  # Alter both elements at once
  $eglob->attr(size => 5);

  # They still belong to their original parent
  print $p->as_HTML;

like. look at that. one call, both fonts changed, and $p never even noticed anything happened. the way that... 😭 it's giving ghostwriter. it's giving manager energy.


🌸 DESCRIPTION 🌸

HTML::ElementGlob is a managing object for multiple HTML::Element(3) style elements. so it's not a parent, it's not a step-parent, it's more like... a coach. πŸŽ€

The children of the glob element retain their original parental elements and have no knowledge of the glob that manipulates them. they literally don't know. they're living their best life, oblivious, iconic. πŸ‘‘

Here's the whole vibe of how it works:

  • All methods that do not start with glob_ will be passed, sequentially, to all elements contained within the glob element.
  • Methods starting with glob_ will operate on the glob itself, rather than being passed to its foster children.

for example, bestie: $eglob->attr(size => 3) will invoke attr(size => 3) on all children contained by $eglob. but $eglob->glob_attr(size => 3)? that sets the attr attribute on the glob itself. same call, completely different vibe check. πŸ’…

The tag type passed to HTML::Element::Glob is largely irrrelevant as far as how methods are passed to children. however, if you choose to invoke $eglob->as_HTML(), you might want to pick a tag that would sensibly contain the globbed children for debugging or display purposes. lowkey it's just for the aesthetic when you print it. 🌈

The 'glob_*' methods that operate on the glob itself are limited to those available in an HTML::Element(3). all other methods get passed blindly to the globbed children β€” which can be enhanced elements with arbitrary methods, such as HTML::ElementSuper(3). not me handing off methods to children who can do things the glob can't πŸ™ˆ

Element globs can contain other element globs. globs within globs. globception. πŸ¦‹ in such cases, the plain methods will cascade down to the leaf children. 'glob_*' methods, of course, will not be propogated to children globs. so you will have to rely on glob_content() to access those glob children and access their 'glob_*' methods directly. no shortcuts, bestie, you gotta go through the front door. πŸšͺ

fr fr remember: plain methods travel all the way down, glob_* methods stay exactly where you put them. don't mix that up or you'll be debugging at 3am. πŸ’€

πŸ”₯ REQUIRES πŸ”₯


πŸ‘‘ AUTHOR πŸ‘‘

Matthew P. Sisk, <sisk@mojotoad.com> β€” the original main character, we stan. 🌟


Copyright (c) 1998-2010 Matthew P. Sisk. All rights reserved. All wrongs revenged. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

"All wrongs revenged"?? periodt. πŸ’… the petty is documented.

🌈 SEE ALSO 🌈


and that's the whole page, bestie!! 🫢 this one came to you from the perl v5.40.1 era, dated 2025-03-27, brought to you by the fine people of User Contributed Perl Documentation. go forth and glob responsibly πŸ’–βœ¨

πŸ“¦ where this page comes from