GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  CSS::SAC::CONDITION (3)

.ds Aq ’

NAME

CSS::SAC::Condition - base class for SAC conditions

CONTENTS

SYNOPSIS



  use CSS::SAC::Condition qw(:constants);
  foo if $cond->is_type(CONDITION_TYPE_CONSTANT);



DESCRIPTION

SAC Conditions describe conditions that can be expressed in CSS such as AttributeConditions or PositionalConditions. This class provides everything that is needed to implement simple conditions (methods, constants) as well as what is needed by subclasses defining more complex conditions.

The constants are those defined in the SAC spec, with the leading SAC_ removed. What the constants map to is to be considered an opaque token that can be tested for equality. If there is demand for it, I will add a way to add new constants (for people wishing to define new condition types).

I have also added the UNKNOWN_CONDITION constant. It shouldn’t occur in normal processing but it’s always useful to have such fallback values.

The Condition interface adds $cond->is_type($condition_type) to the interface defined in the SAC spec. This allows for more flexible type checking. For instance, if you create a subclass of ContentCondition that extends it with the ContentRegexCondition interface you will probably want software ignorant of your subclass’s existence to still be able to do something useful with it. That software should also be able to treat ContentRegexConditions as if they were ContentConditions.

If that software tests condition types the following way:



  $rcond->ConditionType == CONTENT_CONDITION



then you’ve lost because the condition type of ContentRegexCondition is REGEX_CONTENT_CONDITION. If, however, it tests it that way:



  $rcond->is_type(CONTENT_CONDITION)



then you can simply implement is_type() so that it returns true for it’s own type and the type of it’s superclass. I strongly recommend using the latter scheme except in cases when you want to know the exact type.

CONSTANTS

o UNKNOWN_CONDITION
o AND_CONDITION
o ATTRIBUTE_CONDITION
o BEGIN_HYPHEN_ATTRIBUTE_CONDITION
o CLASS_CONDITION
o CONTENT_CONDITION
o ID_CONDITION
o LANG_CONDITION
o NEGATIVE_CONDITION
o ONE_OF_ATTRIBUTE_CONDITION
o ONLY_CHILD_CONDITION
o ONLY_TYPE_CONDITION
o OR_CONDITION
o POSITIONAL_CONDITION
o PSEUDO_CLASS_CONDITION

METHODS

o CSS::SAC::Condition->new($type) or $cond->new($type)

Creates a new condition. The $type must be one of the type constants.

o $cond->ConditionType()

Returns the constant corresponding to the type of this condition.

o $cond->is_type($condition_type)

Returns a boolean indicating whether this condition is of type $condition_type (a condition constant).

AUTHOR

Robin Berjon <robin@knowscape.com>

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

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 CSS::SAC::CONDITION (3) 2001-08-17

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.