| 1 | |||||||||||||
| 2 | ### | ||||||||||||
| 3 | # CSS::SAC::SelectorList - SAC SelectorLists | ||||||||||||
| 4 | # Robin Berjon <robin@knowscape.com> | ||||||||||||
| 5 | # 24/02/2001 - prototype mark I of the new model | ||||||||||||
| 6 | ### | ||||||||||||
| 7 | |||||||||||||
| 8 | package CSS::SAC::SelectorList; | ||||||||||||
| 9 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | 2 | ▶ | use vars qw($VERSION); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | |||||||||||||
| 12 | 2 | ▶ | $VERSION = $CSS::SAC::VERSION || '0.03'; | ||||||||||
|
Condition50%1/2
$CSS::SAC::VERSION || '0.03'
MC/DC0%0/1
$CSS::SAC::VERSION || '0.03'
$CSS::SAC::VERSION
Truth table50%1/2
A
A= $CSS::SAC::VERSION
| |||||||||||||
| 13 | |||||||||||||
| 14 | |||||||||||||
| 15 | ### Constructor ####################################################### | ||||||||||||
| 16 | # # | ||||||||||||
| 17 | # # | ||||||||||||
| 18 | |||||||||||||
| 19 | |||||||||||||
| 20 | #---------------------------------------------------------------------# | ||||||||||||
| 21 | # CSS::SAC::SelectorList->new(\@list) | ||||||||||||
| 22 | # creates a new list | ||||||||||||
| 23 | #---------------------------------------------------------------------# | ||||||||||||
| 24 | 44 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||
| 25 | 44 | my $class = shift; | |||||||||||
| 26 | 44 | ▶ | my $list = shift || []; | ||||||||||
|
Condition50%1/2
shift() || []
MC/DC0%0/1
shift() || []
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 27 | |||||||||||||
| 28 | 44 | return bless $list, $class; | |||||||||||
| 29 | } | ||||||||||||
| 30 | #---------------------------------------------------------------------# | ||||||||||||
| 31 | |||||||||||||
| 32 | |||||||||||||
| 33 | # # | ||||||||||||
| 34 | # # | ||||||||||||
| 35 | ### Constructor ####################################################### | ||||||||||||
| 36 | |||||||||||||
| 37 | |||||||||||||
| 38 | |||||||||||||
| 39 | ### Accessors ######################################################### | ||||||||||||
| 40 | # # | ||||||||||||
| 41 | # # | ||||||||||||
| 42 | |||||||||||||
| 43 | |||||||||||||
| 44 | #---------------------------------------------------------------------# | ||||||||||||
| 45 | # $sl->Length | ||||||||||||
| 46 | # returns the length of the list | ||||||||||||
| 47 | #---------------------------------------------------------------------# | ||||||||||||
| 48 | 0 | ▶ | sub Length { | ||||||||||
|
Subroutine
Length: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 49 | 0 | return scalar @$_[0]; | |||||||||||
| 50 | } | ||||||||||||
| 51 | #---------------------------------------------------------------------# | ||||||||||||
| 52 | 2 | *CSS::SAC::SelectorList::getLength = \&Length; | |||||||||||
| 53 | |||||||||||||
| 54 | #---------------------------------------------------------------------# | ||||||||||||
| 55 | # $sl->Item($pos,[$sel]) | ||||||||||||
| 56 | # get/set the item at that position | ||||||||||||
| 57 | #---------------------------------------------------------------------# | ||||||||||||
| 58 | 0 | ▶ | sub Item { | ||||||||||
|
Subroutine
Item: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||
| 59 | 0 | ▶ | (@_ == 2) ? $_[0]->[$_[1]] = $_[2] : | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 60 | $_[0]->[$_[1]]; | ||||||||||||
| 61 | } | ||||||||||||
| 62 | #---------------------------------------------------------------------# | ||||||||||||
| 63 | 2 | *CSS::SAC::SelectorList::item = \&Item; | |||||||||||
| 64 | |||||||||||||
| 65 | |||||||||||||
| 66 | # # | ||||||||||||
| 67 | # # | ||||||||||||
| 68 | ### Accessors ######################################################### | ||||||||||||
| 69 | |||||||||||||
| 70 | |||||||||||||
| 71 | =pod | ||||||||||||
| 72 | |||||||||||||
| 73 | =head1 NAME | ||||||||||||
| 74 | |||||||||||||
| 75 | CSS::SAC::SelectorList - SAC SelectorLists | ||||||||||||
| 76 | |||||||||||||
| 77 | =head1 SYNOPSIS | ||||||||||||
| 78 | |||||||||||||
| 79 | fill this in later... | ||||||||||||
| 80 | |||||||||||||
| 81 | =head1 DESCRIPTION | ||||||||||||
| 82 | |||||||||||||
| 83 | SAC SelectorLists are simple arrayrefs with a few methods on top. I | ||||||||||||
| 84 | recommend that you use them the Perl way because they are really | ||||||||||||
| 85 | nothing more than arrays. However there was demand for the methods | ||||||||||||
| 86 | that exist in the spec, so I added this interface. | ||||||||||||
| 87 | |||||||||||||
| 88 | =head1 METHODS | ||||||||||||
| 89 | |||||||||||||
| 90 | =over | ||||||||||||
| 91 | |||||||||||||
| 92 | =item * CSS::SAC::SelectorList->new(\@selectors) or $sl->new(\@selectors) | ||||||||||||
| 93 | |||||||||||||
| 94 | Creates a new sl, optionally with those selectors. | ||||||||||||
| 95 | |||||||||||||
| 96 | =item * $sl->Length | ||||||||||||
| 97 | |||||||||||||
| 98 | Returns the length of the array | ||||||||||||
| 99 | |||||||||||||
| 100 | =item * $sel->Item($index,[$selector]) | ||||||||||||
| 101 | |||||||||||||
| 102 | get/set a selector at that (0-based) index in the array | ||||||||||||
| 103 | |||||||||||||
| 104 | =back | ||||||||||||
| 105 | |||||||||||||
| 106 | =head1 AUTHOR | ||||||||||||
| 107 | |||||||||||||
| 108 | Robin Berjon <robin@knowscape.com> | ||||||||||||
| 109 | |||||||||||||
| 110 | This module is licensed under the same terms as Perl itself. | ||||||||||||
| 111 | |||||||||||||
| 112 | =cut | ||||||||||||