Venus::Kind::Value - Value Base Class
Value Base Class for Perl 5
package Example; use Venus::Class; base 'Venus::Kind::Value'; package main; my $example = Example->new; # $example->defined;
This package provides identity and methods common across all Venus value classes.
This package inherits behaviors from:
Venus::Kind
This package integrates behaviors from:
Venus::Role::Accessible
Venus::Role::Buildable
Venus::Role::Explainable
Venus::Role::Pluggable
Venus::Role::Valuable
This package provides the following methods:
cast(Str $kind) (Object | Undef)
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.
undef
Since 0.08
0.08
package main; my $example = Example->new; my $cast = $example->cast; # bless({value => undef}, "Venus::Undef")
package main; my $example = Example->new( value => 123.45, ); my $cast = $example->cast('array'); # bless({value => [123.45]}, "Venus::Array")
package main; my $example = Example->new( value => 123.45, ); my $cast = $example->cast('hash'); # bless({value => {'123.45' => 123.45}, "Venus::Hash")
defined() (Int)
The defined method returns truthy or falsy if the underlying value is "defined".
Since 0.01
0.01
package main; my $example = Example->new; my $defined = $example->defined; # 0
package main; my $example = Example->new(time); my $defined = $example->defined; # 1
explain() (Any)
The explain method returns the value set and is used in stringification operations.
package main; my $example = Example->new('hello, there'); my $explain = $example->explain; # "hello, there"
To install Venus, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Venus
CPAN shell
perl -MCPAN -e shell install Venus
For more information on module installation, please visit the detailed CPAN module installation guide.