CSS::Value - A property value in a CSS object tree


CSS documentation Contained in the CSS distribution.

Index


Code Index:

NAME

Top

CSS::Value - A property value in a CSS object tree

SYNOPSIS

Top

  use CSS;

DESCRIPTION

Top

This module represents a property value in a CSS object tree. Read the CSS.pm pod for information about the CSS object tree.

METHODS

Top

CONSTRUCTORS

new() or new( { ..options.. } )

This constructor returns a new CSS::Value object, with an optional hash of options.

  value		value string
  adaptor       adaptor to use for serialization

ACCESSORS

to_string()

This method is used to serialize the value.

AUTHOR

Top

Copyright (C) 2003-2004, Cal Henderson <cal@iamcal.com>

SEE ALSO

Top

CSS, http://www.w3.org/TR/REC-CSS1


CSS documentation Contained in the CSS distribution.

package CSS::Value;

$VERSION = 1.03;

use strict;
use warnings;
use overload '""' => 'to_string';

sub new {
        my $class = shift;
        my $self = bless {}, $class;

	$self->{options}	= shift;
	$self->{value}		= '';
	$self->{adaptor}	= 'CSS::Adaptor';

        $self->{value}		= $self->{options}->{value} if defined $self->{options}->{value};
	$self->{adaptor}	= $self->{options}->{adaptor} if defined $self->{options}->{adaptor};

        return $self;
}

sub to_string {
	my $self = shift;
	my $adaptor_obj = new $self->{adaptor};
	return $adaptor_obj->output_value($self);
}

1;

__END__