CSS::SAC::LexicalUnit - SAC units
use CSS::SAC::LexicalUnit qw(:constants);
foo if $lu->is_type(LU_TYPE_CONSTANT);
In the SAC spec, LexicalUnit is a linked list, that is, you only ever hold one
LexicalUnit, and you ask for the next of for the previous one when you want to
Such a model seems awkward, though I'm sure it makes sense somehow
in Java, likely for a Java-specific reason.
In the Perl implementation, I have changed this. A LexicalUnit is
an object that stands on it's own and has no next/previous objects. Instead,
the $handler->property callback gets called with
a LexicalUnitList, which is in fact just an array ref of LexicalUnits.
We also don't differentiate between IntegerValue, FloatValue, and
StringValue, it's always Value in Perl. This also applies to Parameters and
SubValues. Both are called as Value and return an array ref of
I added the is_type() method, see CSS::SAC::Condition for
advantages of that approach.
Robin Berjon <firstname.lastname@example.org>
- CSS::SAC::LexicalUnit->new($type,$text,$value) or
Creates a new unit. The $type must be
one of the type constants, the text depends on the type of unit (unit
text, func name, etc...), and the value is the content of the lu.
- $lu->DimensionUnitText([$dut]) or
get/set the text of the dimension unit (eg cm, px, etc...)
- $lu->FunctionName([$fn]) or getFunctionName
get/set the name of the function (eg attr, uri, etc...)
- $lu->Value([$value]) or getValue
get/set the value of the lu (which may be another lu, or a lu
- $lu->LexicalUnitType([$type]) or
get/set the type of the lu
returns true is this lu is of type
This module is licensed under the same terms as Perl itself.