SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

BotDetect - Real-Time Bot Detection API
 
 

MAN page from Old RedHat 6.X perl-HTML-Element-Extended-1.06-6.i386.rpm

lib::HTML::ElementSuper

Section: User Contributed Perl Documentation (3)
Updated: perl 5.005, patch 03
Index 

NAME

HTML::ElementSuper - Perl extension for HTML::Element(3) 

SYNOPSIS

  use HTML::ElementSuper;
  ### Positional extension  $e = new HTML::ElementSuper 'font';  $sibling_number = $e->addr();  $e2 = new HTML::ElementSuper 'p';  $e2->push_content($e);  #   @coords = $e->position();  $depth_in_pos_tree = $e->depth();
  ### Replacer extension  $er = new HTML::ElementSuper 'font';  # Tree beneath $er, if present, is dropped.  $er->replace_content(new HTML::Element 'p');
  ### Wrapper extension  $ew = new HTML::ElementSuper;  $ew->push_content("Tickle me, baby");  $ew->wrap_content(new HTML::Element 'font', color => 'pink');  print $ew->as_HTML();
  ### Maskable extension  $em = new HTML::ElementSuper 'td';  $em->mask(1);  print $em->as_HTML; # nada  $em->mask(0);  print $em->as_HTML; # $e and its children are visible
  ### Cloning of own tree or another element's tree  ### (is this the correct clomenature?  :-)  $a = new HTML::ElementSuper 'font', size => 2;  $b = new HTML::ElementSuper 'font', color => 'red';  $a_clone  = $a->clone;  $b_clone = $a->clone($b);  # Multiple elements can be cloned  @clone_clones = $a_clone->clone($a_clone, $b_clone);
 

DESCRIPTION

HTML::ElementSuper is an extension for HTML::Element(3) that providesseveral new methods to assist in element manipulation. An HTML::ElementSuperhas the following additional properties:

   * report is coordinate position in a tree of its peers   * replace its contents   * wrap its contents in a new element   * mask itself so that it and its descendants are invisible     to traverse()   * clone itself and other HTML::Element based object trees
Note that these extensions were originally developed to assist inimplementing the HTML::ElementTable(3) class, but were thought to beof general enough utility to warrant their own package. 

METHODS


new('tag', attr => `value', ...)
Return a new HTML::ElementSuper object. Exactly like the constructorfor HTML::Element(3), takes a tag type and optional attributes.
addr()
Returns the position of this element in relation to its siblingsbased on the content of the parent, starting with 0. Returnsundef if this element has no parent. In other words, this returnsthe index of this element in the content array of the parent.
position()
Returns the coordinates of this element in the tree it inhabits.This is accomplished by succesively calling addr() on ancestorelements until either a) an element that does not support thesemethods is found, or b) there are no more parents. The resultinglist is the n-dimensional coordinates of the element in the tree.
replace_content(@new_content)
Simple shortcut method that deletes the current contents of theelement before adding the new.
wrap_content($wrapper_element)
Wraps the existing content in the provided element. If theprovided element happens to be a non-element, a push_contentis performed instead.
mask

mask(mode)
Toggles whether or not this element is visible to parentalmethods that visit the element tree using traverse(), such asas_HTML(). Valid arguments for mask() are 0 and 1. Returnsthe current setting without an argument.

This might seem like a strange method to have, but it helpsin managing dynamic tree structures. For example, in HTML::ElementTable(3),when you expand a table cell you simply mask what it coversrather than destroy it. Shrinking the table cell reveals thatcontent to as_HTML() once again.

clone

clone(@elements)
Returns a clone of elements and all of their descendants. Withoutarguments, the element clones itself, otherwise it clones theelements provided as arguments. Any element can be cloned as longas it is HTML::Element(3) based. This method is very handy forduplicating tree structures since an HTML::Element cannot havemore than one parent at any given time...hence ``tree''.
 

REQUIRES

HTML::Element(3), Data::Dumper(3) 

AUTHOR

Matthew P. Sisk, <siskAATTmojotoad.com> 

COPYRIGHT

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

SEE ALSO

HTML::Element(3), HTML::ElementGlob(3), HTML::ElementRaw(3), HTML::ElementTable(3), perl(1).


 

Index

NAME
SYNOPSIS
DESCRIPTION
METHODS
REQUIRES
AUTHOR
COPYRIGHT
SEE ALSO

This document was created byman2html,using the manual pages.
 
ICM Bot detect detector