Stuff
2000-08-17 #### html / \ head body / / | \ title "Stuff" hr "2000-08-17" | "Doc 1" #### [% IF age < 10 %] Hello, does your mother know you're using her AOL account? [% ELSIF age < 18 %] Sorry, you're not old enough to enter (and too dumb to lie about your age) [% ELSE %] Welcome [% END %] #### ROOT child1: Hello, does your mother know you're ... child2: Sorry, you're not old enough to enter ... child3: Welcome #### Hello, does your mother know you're using her AOL account? Sorry, you're not old enough to enter (and too dumb to lie about your age) Welcome #### use HTML::TreeBuilder; my $tree = HTML::TreeBuilder->new(); $tree->parse_file($filename); $tree->age_handler($age); print $tree->as_HTML; sub age_handler { my ($tree, $age) = @_; my $SPAN = $tree->look_down('id', 'age_handler'); if ($age < 10) { $SPAN->look_down('id', $_)->detach for qw(under18 welcome); } elsif ($age < 18) { $SPAN->look_down('id', $_)->detach for qw(under10 welcome); } else { $SPAN->look_down('id', $_)->detach for qw(under10 under18); } } #### look_down->detach() for ($this, $that) #### $SPAN->KILL_CHILDREN (@children); # fodder for carnivore :)