Cal Henderson > CSS-0.08 > CSS

Download:
CSS-0.08.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  6
Open  3
View/Report Bugs
Module Version: 0.08   Source   Latest Release: CSS-1.09

NAME ^

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

SYNOPSIS ^

  use CSS;
  ...

DESCRIPTION ^

CSS.pm 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?).

METHODS ^

CONSTRUCTOR

Only one constructor: new(). Called with:

  -source       required        the source CSS file
  -adaptor      optional        used for transforming properties

ACCESSORS

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

 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.

AUTHORS ^

Copyright (C) 2001-2002 Allen Day <allenday@ucla.edu>

Copyright (C) 2003 Cal Henderson <cal@iamcal.com>

SEE ALSO ^

CSS::Style

CSS::Adaptor

perl(1)

syntax highlighting: