Venus::Kind::Value

Value Base Class

Value Base Class for Perl 5

method: cast method: defined method: explain method: mutate

package Example;

use Venus::Class;

base 'Venus::Kind::Value';

sub test {
  $_[0]->get + 1
}

package main;

my $example = Example->new(1);

# $example->defined;

This package provides identity and methods common across all Venus value classes.

Venus::Kind

Venus::Role::Accessible Venus::Role::Buildable Venus::Role::Explainable Venus::Role::Pluggable Venus::Role::Proxyable Venus::Role::Valuable

The cast method converts "value" objects between different "value" object types, based on the name of the type provided. This method will return undef if the invocant is not a Venus::Kind::Value.

cast(string $kind) (object | undef)

{ since => '0.08', }

=example-1 cast

package main;

my $example = Example->new;

my $cast = $example->cast;

# bless({value => undef}, "Venus::Undef")

The defined method returns truthy or falsy if the underlying value is "defined".

defined() (number)

{ since => '0.01', }

=example-1 defined

package main;

my $example = Example->new;

my $defined = $example->defined;

# 0

The explain method returns the value set and is used in stringification operations.

explain() (any)

{ since => '0.01', }

=example-1 explain

package main;

my $example = Example->new('hello, there');

my $explain = $example->explain;

# "hello, there"

The mutate method dispatches the method call or executes the callback and returns the result, which if is of the same type as the invocant's underlying data type will update the object's internal state or will throw an exception.

mutate(string | coderef $code, any @args) (object)

{ since => '1.23', }

=example-1 mutate

# given: synopsis

package main;

$example->mutate('test');

$example;

# bless({value => 2}, "Example")

t/Venus.t: present: authors t/Venus.t: present: license

24 POD Errors

The following errors were encountered while parsing the POD:

Around line 16:

Unknown directive: =name

Around line 24:

Unknown directive: =tagline

Around line 32:

Unknown directive: =abstract

Around line 40:

Unknown directive: =includes

Around line 51:

Unknown directive: =synopsis

Around line 79:

Unknown directive: =description

Around line 88:

Unknown directive: =inherits

Around line 96:

Unknown directive: =integrates

Around line 109:

Unknown directive: =method

Around line 115:

Unknown directive: =signature

Around line 119:

Unknown directive: =metadata

Around line 158:

=cut found outside a pod block. Skipping to next block.

Around line 181:

=cut found outside a pod block. Skipping to next block.

Around line 192:

Unknown directive: =method

Around line 197:

Unknown directive: =signature

Around line 201:

Unknown directive: =metadata

Around line 236:

=cut found outside a pod block. Skipping to next block.

Around line 246:

Unknown directive: =method

Around line 251:

Unknown directive: =signature

Around line 255:

Unknown directive: =metadata

Around line 281:

Unknown directive: =method

Around line 287:

Unknown directive: =signature

Around line 291:

Unknown directive: =metadata

Around line 326:

Unknown directive: =partials