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
CSS::Sass::Value(3) User Contributed Perl Documentation CSS::Sass::Value(3)

CSS::Sass::Value - Data Types for custom Sass Functions

You can use "maps" and "lists" like normal "hash" or "array" references. Lists can have two different separators used for stringification. This is detected by checking if the object is derived from "CSS::Sass::Value::List::Space". The default is a comma separated list, which you get by instantiating "CSS::Sass::Value::List" or "CSS::Sass::Value::List::Comma".

    my $null = CSS::Sass::Value->new(undef); # => 'null'
    my $number = CSS::Sass::Value->new(42.35); # => 42.35
    my $string = CSS::Sass::Value->new("foobar"); # => 'foobar'
    my $map = CSS::Sass::Value->new({ key => "foobar" }); # 'key: foobar'
    my $list = CSS::Sass::Value->new([ "foo", 42, "bar" ]); # 'foo, 42, bar'
    my $space = CSS::Sass::Value::List::Space->new("foo", "bar"); # 'foo bar'
    my $comma = CSS::Sass::Value::List::Comma->new("foo", "bar"); # 'foo, bar'

You can also return these native perl types from custom functions. They will automatically be upgraded to real "CSS::Sass::Value" objects. All types overload the "stringify" and "eq" operators (so far).

Acts as a base class for all other types and is mainly an abstract class. It only implements a generic constructor, which accepts native perl data types (undef, numbers, strings, array-refs and hash-refs) and "CSS::Sass::Value" objects.

    my $null = CSS::Sass::Value::Null->new;
    my $string = "$null"; # eq 'null'
    my $value = $null->value; # == undef

    my $bool = CSS::Sass::Value::Boolean->new(42);
    my $string = "$bool"; # eq 'true'
    my $value = $bool->value; # == 1

    my $number = CSS::Sass::Value::Boolean->new(42, 'px');
    my $string = "$number"; # eq '42px'
    my $value = $number->value; # == 42
    my $unit = $number->unit; # eq 'px'

    my $string = CSS::Sass::Value->new("foo bar"); # => "foo bar"
    my $quoted = "$string"; # eq '"foo bar"'
    my $unquoted = $string->value; # eq 'foo bar'

    my $color = CSS::Sass::Value::Color->new(64, 128, 32, 0.25);
    my $string = "$color"; # eq 'rgba(64, 128, 32, 0.25)'
    my $r = $color->r; # == 64
    my $g = $color->g; # == 128
    my $b = $color->b; # == 32
    my $a = $color->a; # == 0.25

    my $map = CSS::Sass::Value::Map->new(key => 'value');
    my $string = "$map"; # eq 'key: "value"'
    my $value = $map->{'key'}; # eq '"value"'

    my $list = CSS::Sass::Value::List::Comma->new('foo', 'bar');
    my $string = "$list"; # eq '"foo", "bar"'
    my $value = $list->[0]; # eq 'foo'

    my $list = CSS::Sass::Value::List::Space->new('foo', 'bar');
    my $string = "$list"; # eq '"foo" "bar"'
    my $value = $list->[-1]; # eq 'bar'

CSS::Sass

David Caldwell <david@porkrind.org> Marcel Greter <perl-libsass@ocbnet.ch>

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

2021-05-21 perl v5.32.1

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

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