| 1 | package CSS::DOM::Array; | ||||||||||
| 2 | |||||||||||
| 3 | 25 | $VERSION = '0.16'; | |||||||||
| 4 | |||||||||||
| 5 | 25 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 25 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | sub new { | ||||||||||
| 9 | 204 | ▶ | bless[@_[1..$#_]], shift; | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 10 | } | ||||||||||
| 11 | |||||||||||
| 12 | 18 | ▶ | sub length { scalar @{+shift} } | ||||||||
|
Subroutine
length: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 13 | sub item { | ||||||||||
| 14 | 6 | ▶ | my $self = shift; | ||||||||
|
Subroutine
item: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||
| 15 | 6 | ▶ | $_[0] > $#$self ? () : $self->[$_[0]] | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | }; | ||||||||||
| 17 | |||||||||||
| 18 | 25 | !()__END__()! | |||||||||
| 19 | |||||||||||
| 20 | =head1 NAME | ||||||||||
| 21 | |||||||||||
| 22 | CSS::DOM::Array - Array class for CSS::DOM | ||||||||||
| 23 | |||||||||||
| 24 | =head1 VERSION | ||||||||||
| 25 | |||||||||||
| 26 | Version 0.16 | ||||||||||
| 27 | |||||||||||
| 28 | =head1 SYNOPSIS | ||||||||||
| 29 | |||||||||||
| 30 | use CSS::DOM::Array; | ||||||||||
| 31 | |||||||||||
| 32 | $array = new CSS::DOM::Array 'this', 'that'; | ||||||||||
| 33 | |||||||||||
| 34 | @$array; | ||||||||||
| 35 | $array->[0]; | ||||||||||
| 36 | # etc. | ||||||||||
| 37 | |||||||||||
| 38 | $array->length; | ||||||||||
| 39 | $array->item(0); | ||||||||||
| 40 | |||||||||||
| 41 | =head1 DESCRIPTION | ||||||||||
| 42 | |||||||||||
| 43 | This module serves as a base class for array-like objects required by | ||||||||||
| 44 | L<CSS::DOM>. | ||||||||||
| 45 | |||||||||||
| 46 | A CSS::DOM::Array object is simply a blessed array reference. You can use | ||||||||||
| 47 | it as an array directly, or use the methods below. | ||||||||||
| 48 | |||||||||||
| 49 | =head1 METHODS | ||||||||||
| 50 | |||||||||||
| 51 | =head2 Constructor | ||||||||||
| 52 | |||||||||||
| 53 | $array = new CSS::DOM::Array; | ||||||||||
| 54 | |||||||||||
| 55 | Creates a new blessed array. | ||||||||||
| 56 | |||||||||||
| 57 | =head2 Object Methods | ||||||||||
| 58 | |||||||||||
| 59 | =over 4 | ||||||||||
| 60 | |||||||||||
| 61 | =item length | ||||||||||
| 62 | |||||||||||
| 63 | Returns the length of the array. | ||||||||||
| 64 | |||||||||||
| 65 | =item item ( $index) | ||||||||||
| 66 | |||||||||||
| 67 | Returns the array element at the given C<$index>. | ||||||||||
| 68 | |||||||||||
| 69 | =back | ||||||||||
| 70 | |||||||||||
| 71 | =head1 SEE ALSO | ||||||||||
| 72 | |||||||||||
| 73 | L<CSS::DOM> | ||||||||||
| 74 | |||||||||||
| 75 | L<CSS::DOM::RuleList> | ||||||||||
| 76 | |||||||||||
| 77 | L<CSS::DOM::StyleSheetList> | ||||||||||
| 78 | |||||||||||
| 79 | L<CSS::DOM::MediaList> | ||||||||||