CSS::Object::Value(3)

πŸ“¦ version 0.2.0, in alpine 3.24

✨ NAME ✨

okay bestie, welcome to the User Contributed Perl Documentation page for CSS::Object::Value(3) πŸ’–

CSS::Object::Value β€” CSS Object Oriented Value. That's the whole vibe: it's the module that holds a CSS property's value. Slay.


πŸ¦‹ SYNOPSIS πŸ¦‹

        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 );

⭐ VERSION ⭐

v0.2.0 β€” periodt πŸ’…


πŸ’… DESCRIPTION πŸ’…

CSS::Object::Value is a module to contain the CSS properties' value. Literally its whole job. Iconic, focused, no notes. πŸŽ€


πŸŽ€ CONSTRUCTOR πŸŽ€

🐣 new

To instantiate a new CSS::Object::Value object, pass a hash reference with these parameters, bestie:

  • debug β€” this is an integer. The bigger it is, the more verbose the output gets. It's giving "turn the volume up" energy πŸ”₯
  • format β€” this is a CSS::Object::Format object or one of its child modules.
  • value β€” the property value, which can also be called as the sole argument:
            # For display property for example
            my $val = CSS::Object::Value->new( 'none' );
  • with_comment β€” this parameter must be a hash reference with 2 possible properties: before and after. Each of those properties can contain either a simple string, an array reference of string, or an CSS::Object::Comment object.

It returns our object 🫢


🌸 METHODS 🌸

as_string

This calls the format object and its value_as_string method in CSS::Object::Format.

It returns the CSS string produced, or undef, and sets a Module::Generic::Exception upon error. No cap, that's the deal. πŸ’€

format

This is a CSS::Object::Format object or one of its child modules.

value

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. Simple, clean, main character behavior πŸ‘‘

with_comment

This method takes a hash reference with 2 possible properties: before and after. Each of those 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. πŸ¦‹


πŸ‘‘ AUTHOR πŸ‘‘

Jacques Deguest <jack@deguest.jp> β€” the author himself, bestie. Respect the icon πŸ’–


🌈 SEE ALSO 🌈

CSS::Object β€” go peek, iykyk 🌟


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.


πŸ’Œ okay that's the whole page. This one was served up for perl v5.42.2, dated 2026-02-15, and it's giving CSS::Object::Value(3) energy. bye bestie πŸ«ΆπŸ’…

πŸ“¦ where this page comes from