CSS::Object::Rule - CSS Object Oriented Rule
use CSS::Object::Rule; my $rule = CSS::Object::Rule->new( debug => 3, format => $format_object ) || die( CSS::Object::Rule->error );
v0.1.3
CSS::Object::Rule a class containing one or more CSS::Object::Selector objects and one ore more CSS::Object::Property objects.
To instantiate a new CSS::Object::Rule object, pass an hash reference of following parameters:
This is an integer. The bigger it is and the more verbose is the output.
This is a CSS::Object::Format object or one of its child modules.
Provided with a CSS::Object::Element object and this add it to the array of "elements" for this rule.
Provided with a CSS::Object::Property object and this adds it to the list of properties contained in this rule.
The object is added to the "properties" array object, which is an Module::Generic::Array object.
Provided with a CSS::Object::Selector object and this adds it to the list of selectors contained in this rule.
The object is added to the "selectors" array object, which is an Module::Generic::Array object.
Provided with a CSS::Object object and this add our object to its list of elements by calling "add_rule" in CSS::Object
This calls the "format" and its method "rule_as_string" in CSS::Object::Format
It returns the css string produced or undef and sets an Module::Generic::Exception upon error.
Sets or gets the list of elements for this rule. This uses an array object from Module::Generic::Array
Typical elements for a rule are properties (CSS::Object::Property) and comments (CSS::Object::Comment).
This takes our list of "elements" and call CSS:Object::Format/elements_as_string to stringify them and return a formatted string.
Provided with a property name, and this returns its matching CSS::Object::Property objects.
It returns a list of objects in list context or an empty list if no match found.
In object context, it returns the first match found or the Module::Generic::Null special class object to allow chaining even when nothing was returned. in scalar context, it just returns the first entry found, if any, so this could very well be undefined.
This sets or gets the Module::Generic::Array object used to store all the CSS::Object::Property objects.
This returns the string value of all the properties objects currently held. It calls the method "properties_as_string" in CSS::Object::Format to stringify those properties.
This takes a CSS::Object as argument and it will remove this current rule object from the css list of rules.
It basically calls "remove_rule" in CSS::Object.
It returns the current rule object.
Given a CSS::Object::Property, this will remove it from its list of elements. It returns the current rule object.
It basically does:
$self->elements->remove( $rule );
This sets or gets the Module::Generic::Array object used to store all the CSS::Object::Selector objects.
This returns the string value of all the selector objects currently held. It calls the method "selectors_as_string" in CSS::Object::Format to stringify those selectors.
Jacques Deguest <jack@deguest.jp>
CSS::Object
Copyright (c) 2020 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.
To install CSS::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CSS::Object
CPAN shell
perl -MCPAN -e shell install CSS::Object
For more information on module installation, please visit the detailed CPAN module installation guide.