The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Sofu::Value - A Sofu Value

DESCRIPTION

Provides a interface similar to the original SofuD (sofu.sf.net)

Synopsis

        require Data::Sofu::Value;
        my $v = Data::Sofu::Value->new();
        $v->set("Hello World");

SYNTAX

This Module is pure OO, exports nothing

METHODS

Also look at Data::Sofu::Object for methods, cause Value inherits from it

new([DATA])

Creates a new Data::Sofu::Value and returns it

Converts DATA to a string if DATA is given.

        $val = Data::Sofu::Value->new("Hello World");

set(DATA)

Sets the contents of this Value (replaces the old contents).

Note: DATA will be converted to a string.

        $v->set("Foobar");

asValue()

Returns itself, used to make sure this Value is really a Value (Data::Sofu::Map and Data::Sofu::List will die if called with this method)

asScalar()

Perl only

Returns this Value as a perl Scalar (same as toString)

toString()

Returns this as a string

toUTF16(), toUTF8(), toUTF32()

Not working in Perl (cause there is no wchar, char, dchar stuff going on, if you need to convert strings use "Encode")

They just return the same as toString()

toInt()

Return the Value as an Integer

        $v->toInt() ===  int $v->toString();

toFloat()

Return the Value as a Float

        $v->toFloat() ===  $v->toString()+0;

toLong()

Return the Value as a Long

        $v->toLong() ===  int $v->toString();

toDouble()

Return the Value as a Double

        $v->toDouble() ===  $v->toString()+0;

isValue()

Returns 1

stringify(LEVEL,TREE)

Returns a string representation of this Value.

LEVEL and TREE are ignored...

binarify (TREE,BINARY DRIVER)

Returns the binary version of this Value using the BINARY DRIVER. Don't call this one, use binaryPack instead.

BUGS

most of the methods do the same, because perl does the converting for you.

SEE ALSO

Data::Sofu, Data::Sofu::Binary, Data::Sofu::Object, Data::Sofu::Map, Data::Sofu::Value, Data::Sofu::Undefined, http://sofu.sf.net