Venus::Role::Boxable

Boxable Role

Boxable Role for Perl 5

method: box method: boxed

package Example;

use Venus::Class;

with 'Venus::Role::Boxable';

attr 'text';

package main;

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

# $example->box('text')->lc->ucfirst->concat('.')->unbox->get;

# "Hello, world."

This package modifies the consuming package and provides a method for boxing itself. This makes it possible to chain method calls across objects and values.

The box method returns the invocant boxed, i.e. encapsulated, using Venus::Box. This method supports dispatching, i.e. providing a method name and arguments whose return value will be acted on by this method.

box(string | coderef $method, any @args) (object)

{ since => '0.01', }

=example-1 box

package main;

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

my $box = $example->box;

# bless({ value => bless(..., "Example") }, "Venus::Box")

The boxed method dispatches to "box" and returns the "unboxed" value. This method supports dispatching, i.e. providing a method name and arguments whose return value will be acted on by this method.

boxed(string | coderef $method, any @args) (object)

{ since => '4.15', }

=example-1 boxed

# given: synopsis

package main;

my $boxed = $example->boxed;

# bless(..., "Example")

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

15 POD Errors

The following errors were encountered while parsing the POD:

Around line 14:

Unknown directive: =name

Around line 22:

Unknown directive: =tagline

Around line 30:

Unknown directive: =abstract

Around line 38:

Unknown directive: =includes

Around line 47:

Unknown directive: =synopsis

Around line 76:

Unknown directive: =description

Around line 85:

Unknown directive: =method

Around line 91:

Unknown directive: =signature

Around line 95:

Unknown directive: =metadata

Around line 135:

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

Around line 147:

Unknown directive: =method

Around line 153:

Unknown directive: =signature

Around line 157:

Unknown directive: =metadata

Around line 193:

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

Around line 204:

Unknown directive: =partials