CSS::DOM::Array - Array class for CSS::DOM


CSS-DOM documentation Contained in the CSS-DOM distribution.

Index


Code Index:

NAME

Top

CSS::DOM::Array - Array class for CSS::DOM

VERSION

Top

Version 0.14

SYNOPSIS

Top

  use CSS::DOM::Array;

  $array = new CSS::DOM::Array 'this', 'that';

  @$array;
  $array->[0];
  # etc.

  $array->length;
  $array->item(0);

DESCRIPTION

Top

This module serves as a base class for array-like objects required by CSS::DOM.

A CSS::DOM::Array object is simply a blessed array reference. You can use it as an array directly, or use the methods below.

METHODS

Top

Constructor

  $array = new CSS::DOM::Array;

Creates a new blessed array.

Object Methods

length

Returns the length of the array.

item ( $index)

Returns the array element at the given $index.

SEE ALSO

Top

CSS::DOM

CSS::DOM::RuleList

CSS::DOM::StyleSheetList

CSS::DOM::MediaList


CSS-DOM documentation Contained in the CSS-DOM distribution.

package CSS::DOM::Array;

$VERSION = '0.14';

use warnings;
use strict;

sub new {
	bless[@_[1..$#_]], shift;
}

sub length { scalar @{+shift} }
sub item {
	my $self = shift;
	$_[0] > $#$self ? () : $self->[$_[0]]
};

                              !()__END__()!