CSS::Object::Value - CSS Object Oriented Value
use CSS::Object::Value; # For font-size property for example my $val = CSS::Object::Value->new( '1.2rem', debug => 3, format => $format_object, ) || die( CSS::Object::Value->error ); # Adding value with comment inside my $val = CSS::Object::Value->new( '1.2rem', with_comment => { before => 'This is 12px', after => ["Might want to change this", "to something else"], }) || die( "Cannot add value with comments: ", CSS::Object::Value->error ); my $val = CSS::Object::Value->new( '/* Might need to change this */ 1.2rem /* Maybe move this to px instead? */', debug => 3, format => $format_object, ) || die( CSS::Object::Value->error ); # or $val->comment_before->push( $css->new_comment( "More comment before value" )); #val->comment_after->push( $css->new_comment( "Another comment after too" )); # or $val->with_comment({ before => 'This is 12px', after => ["Might want to change this", "to something else"], }) || die( $val->error );
v0.1.0
CSS::Object::Value is a module to contain the CSS properties' value.
To instantiate a new CSS::Object::Value 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.
The property value, which can also be called as the sole argument:
# For display property for example my $val = CSS::Object::Value->new( 'none' );
This parameter must be an hash reference with 2 possible properties: before and after. Each of thoe properties can contain either a simple string, an array reference of string, or an CSS::Object::Comment object.
It returns our object
This calls the "format" and its method "value_as_string" in CSS::Object::Format
It returns the css string produce or undef and sets an Module::Generic::Exception upon error.
Sets or gets the value for this property value. The value stored here becomes a Module::Generic::Scalar and thus all its object methods can be used
Alternatively, it accepts a CSS::Object::Value and will call its "value" method to get the actual string to store.
It returns the value currently stored.
This method takes an hash reference with 2 possible properties: before and after. Each of thoe properties can contain either a simple string, an array reference of string, or an CSS::Object::Comment object.
It returns the object used to call this method, or undef if there was an error.
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.