|
NAMEHTML::DOM::Collection::Options - A subclass of HTML::DOM::Collection for 'option' elementsVERSIONVersion 0.054SYNOPSISuse HTML::DOM; $doc = HTML::DOM->new; $doc->write(' <form name=theform> <select name=choice> <option> <option> </select> </form> '); $doc->close; $options = $doc->forms->{theform}{choice}->options; # returns an HTML::DOM::Collection::Options object $options->[0]; # first option $options->item(0); # same $options->[0] = undef; # deletes it delete $options->[0]; # likewise $options->length; # same as scalar @$options DESCRIPTIONThis inherits from HTML::DOM::Collection and adds a few extra methods for compatibility with WWW::Mechanize. This is used to represent a 'select' element's list of options.CONSTRUCTORNormally you would simply call HTML::DOM::Element::Select's "options" method (as in the "SYNOPSIS"). But if you wall to call the constructor anyway, here is the syntax:$elements = HTML::DOM::Collection::Options->new( $nodelist, $select_elem ) $nodelist should be a node list (HTML::DOM::NodeList) object. ARRAY INTERFACEYou can use an options collection as an array reference. You can even modify it this way. If you assign "undef" to an array element or delete it, it will be removed completely, so "$options->[0] = undef" will cause $options->[1] to become $options->[0], for example.Don't rely on array manipulation functions, such as "shift", "push", "splice", etc. Also, don't rely on list assignments. METHODS
These last few are provided for WWW::Mechanize compatibility.
SEE ALSOHTML::DOMHTML::DOM::Collection HTML::DOM::Element::Select HTML::DOM::Element::Form The source of HTML/DOM/Element/Form.pm, where this is implemented.
Visit the GSP FreeBSD Man Page Interface. |