1HTML::ElementGlob(3) User Contributed Perl Documentation HTML::ElementGlob(3)
2
3
4
6 HTML::ElementGlob - Perl extension for managing HTML::Element based
7 objects as a single object.
8
10 use HTML::ElementGlob;
11 $element_a = new HTML::Element 'font', color => 'red';
12 $element_b = new HTML::Element 'font', color => 'blue';
13 $element_a->push_content('red');
14 $element_b->push_content('blue');
15
16 $p = new HTML::Element 'p';
17 $p->push_content($element_a, ' and ', $element_b, ' boo hoo hoo');
18
19 # Tag type of the glob is not really relevant unless
20 # you plan on seeing the glob as_HTML()
21 $eglob = new HTML::ElementGlob 'p';
22 $eglob->glob_push_content($element_a, $element_b);
23 # Alter both elements at once
24 $eglob->attr(size => 5);
25
26 # They still belong to their original parent
27 print $p->as_HTML;
28
30 HTML::ElementGlob is a managing object for multiple HTML::Element(3)
31 style elements. The children of the glob element retain their original
32 parental elements and have no knowledge of the glob that manipulates
33 them. All methods that do not start with 'glob_' will be passed,
34 sequentially, to all elements contained within the glob element.
35 Methods starting with 'glob_' will operate on the glob itself, rather
36 than being passed to its foster children.
37
38 For example, $eglob->attr(size => 3) will invoke attr(size => 3) on all
39 children contained by $eglob. $eglob->glob_attr(size => 3), on the
40 other hand, will set the attr attribute on the glob itself.
41
42 The tag type passed to HTML::Element::Glob is largely irrrelevant as
43 far as how methods are passed to children. However, if you choose to
44 invoke $eglob->as_HTML(), you might want to pick a tag that would
45 sensibly contain the globbed children for debugging or display
46 purposes.
47
48 The 'glob_*' methods that operate on the glob itself are limited to
49 those available in an HTML::Element(3). All other methods get passed
50 blindly to the globbed children, which can be enhanced elements with
51 arbitrary methods, such as HTML::ElementSuper(3).
52
53 Element globs can contain other element globs. In such cases, the
54 plain methods will cascade down to the leaf children. 'glob_*'
55 methods, of course, will not be propogated to children globs. You will
56 have to rely on glob_content() to access those glob children and access
57 their 'glob_*' methods directly.
58
60 HTML::ElementSuper(3)
61
63 Matthew P. Sisk, <sisk@mojotoad.com>
64
66 Copyright (c) 1998-2010 Matthew P. Sisk. All rights reserved. All
67 wrongs revenged. This program is free software; you can redistribute it
68 and/or modify it under the same terms as Perl itself.
69
71 HTML::Element(3), HTML::ElementSuper, HTML::ElementRaw,
72 HTML::Element::Table(3), perl(1).
73
74
75
76perl v5.28.1 2010-06-09 HTML::ElementGlob(3)