CSS::SAC::SelectorList - SAC SelectorLists


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

Index


Code Index:

NAME

Top

CSS::SAC::SelectorList - SAC SelectorLists

SYNOPSIS

Top

 fill this in later...

DESCRIPTION

Top

SAC SelectorLists are simple arrayrefs with a few methods on top. I recommend that you use them the Perl way because they are really nothing more than arrays. However there was demand for the methods that exist in the spec, so I added this interface.

METHODS

Top

* CSS::SAC::SelectorList->new(\@selectors) or $sl->new(\@selectors)

Creates a new sl, optionally with those selectors.

* $sl->Length

Returns the length of the array

* $sel->Item($index,[$selector])

get/set a selector at that (0-based) index in the array

AUTHOR

Top

Robin Berjon <robin@knowscape.com>

This module is licensed under the same terms as Perl itself.


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

###
# CSS::SAC::SelectorList - SAC SelectorLists
# Robin Berjon <robin@knowscape.com>
# 24/02/2001 - prototype mark I of the new model
###

package CSS::SAC::SelectorList;
use strict;
use vars qw($VERSION);

$VERSION = $CSS::SAC::VERSION || '0.03';


### Constructor #######################################################
#                                                                     #
#                                                                     #


#---------------------------------------------------------------------#
# CSS::SAC::SelectorList->new(\@list)
# creates a new list
#---------------------------------------------------------------------#
sub new {
    my $class = shift;
    my $list = shift || [];

    return bless $list, $class;
}
#---------------------------------------------------------------------#


#                                                                     #
#                                                                     #
### Constructor #######################################################



### Accessors #########################################################
#                                                                     #
#                                                                     #


#---------------------------------------------------------------------#
# $sl->Length
# returns the length of the list
#---------------------------------------------------------------------#
sub Length {
    return scalar @$_[0];
}
#---------------------------------------------------------------------#
*CSS::SAC::SelectorList::getLength = \&Length;

#---------------------------------------------------------------------#
# $sl->Item($pos,[$sel])
# get/set the item at that position
#---------------------------------------------------------------------#
sub Item {
    (@_ == 2) ? $_[0]->[$_[1]] = $_[2] :
                $_[0]->[$_[1]];
}
#---------------------------------------------------------------------#
*CSS::SAC::SelectorList::item = \&Item;


#                                                                     #
#                                                                     #
### Accessors #########################################################