CSS - Perl Object oriented access to Cascading Style Sheets (CSS)


  use CSS;

DESCRIPTION is able to parse a CSS file, and provide the user with an object oriented interface to the CSS file on 3 levels:

 1)the stylesheet as a whole
    my $stylesheet = CSS->new(-source=>"myfile.css");

 2)the selector elements and their associated properties
    my @styles = $stylesheet->styles;
    my %properties = $styles[0]->properties;

 3)the properties and associated values
    my $value = $properties{'some_property'}

In addition, levels 2) and 3) are able to transform the properties returned by using an Adaptor class (see below). This is useful, for instance, if you need the property 'background-color' to be called just that in your stylesheet, but it should be known as 'BGCOLOR' in another context (an HTML generator, perhaps?).



Only one constructor: new(). Called with: -source required the source CSS file -adaptor optional used for transforming properties


 adaptor( scalar )
  read/write.  view/set the adaptor to be used for CSS::Style object 

 add_file(filename or list of filenames) 
   write only.  add selectors from another stylesheet.

 purge( scalar )
   write only.  deletes a selector object.

 style() or styles()
   read only.  returns a list of CSS::Style objects corresponding to
   the current selectors associated with the CSS object.


Allen Day <> Copyright (c) 2001-2002


CSS::Style CSS::Adaptor perl(1).