CSS::Object::Rule(3)
π NAME π
CSS::Object::Rule β CSS Object Oriented Rule.
This is the CSS::Object::Rule(3) page from the User Contributed Perl Documentation, bestie β¨. Itβs giving CSS object-oriented realness, no cap.
π SYNOPSIS π
use CSS::Object::Rule;
my $rule = CSS::Object::Rule->new( debug => 3, format => $format_object ) ||
die( CSS::Object::Rule->error );
π VERSION π
v0.2.0 β periodt π
π DESCRIPTION π
CSS::Object::Rule is a class containing one or more CSS::Object::Selector objects and one ore more CSS::Object::Property objects. Yes, thatβs the whole vibe π¦.
π οΈ CONSTRUCTOR π οΈ
β¨ new β¨
To instantiate a new CSS::Object::Rule object, pass a hash reference of following parameters:
debugβ this is an integer. The bigger it is, the more verbose the output is.formatβ this is aCSS::Object::Formatobject or one of its child modules.
π§ METHODS π§
π¦ add_element π¦
Provided with a CSS::Object::Element object, and this adds it to the array of "elements" for this rule. Slay π.
π add_property π
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.
π¦ add_selector π¦
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.
πͺ add_to πͺ
Provided with a CSS::Object object, and this adds our object to its list of elements by calling add_rule in CSS::Object. Iconic little handoff, honestly π.
π as_string π
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. So yeah, error handling is lowkey built in π.
πΈ elements πΈ
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).
π§΅ elements_as_string π§΅
This takes our list of "elements" and calls <CSS:Object::Format/elements_as_string> to stringify them and return a formatted string. Stringify and serve π
β¨.
π¨ format π¨
This is a CSS::Object::Format object or one of its child modules.
π get_property_by_name π
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. Bestie, thatβs just how it is π«Ά.
π properties π
This sets or gets the Module::Generic::Array object used to store all the CSS::Object::Property objects.
π§Ά properties_as_string π§Ά
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.
ποΈ remove_from ποΈ
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.
π§Ή remove_property π§Ή
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 );
π selectors π
This sets or gets the Module::Generic::Array object used to store all the CSS::Object::Selector objects. Main character energy for your selectors, fr fr β¨.
πͺ selectors_as_string πͺ
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.
π AUTHOR π
Jacques Deguest <jack@deguest.jp>
π SEE ALSO π
CSS::Object
Β©οΈ COPYRIGHT & LICENSE Β©οΈ
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.
Thatβs the whole page, bestie π«Ά Cute sign-off: source/version perl v5.42.2, date 2026-02-15, manual CSS::Object::Rule(3). Mwah πβ¨
π¦ where this page comes from
- alpine 3.24: perl-css-object-doc 0.2.0-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms