Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
HTML::DOM::Collection::Options(3) User Contributed Perl Documentation HTML::DOM::Collection::Options(3)

HTML::DOM::Collection::Options - A subclass of HTML::DOM::Collection for 'option' elements

Version 0.054

  use HTML::DOM;
  $doc = HTML::DOM->new;
      <form name=theform>
        <select name=choice>
  $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

This 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.

Normally 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.

You 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.

Returns the number of items in the collection.
Returns item number $index, numbered from 0. Note that you call also use "$elements->[$index]" for short.
Returns the item named $name. You can also write "$elements->{$name}".
These last few are provided for WWW::Mechanize compatibility.
Returns the string 'option'.
Returns the name of the 'select' element.
Returns the a list of the options' values. Provided for WWW::Mechanize compatibility.
Selects the option with the value given and returns the old value, or simply returns the value if there is no argument.
Returns true if all the options are disabled, false otherwise.
Returns a list consisting of (0) ?the name of the 'select' element and (1) the value of the selected option.

The source of HTML/DOM/Element/, where this is implemented.
2014-12-23 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.