Venus::Role::Boxable
Boxable Role
Boxable Role for Perl 5
method: box
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")
t/Venus.t: present: authors t/Venus.t: present: license
11 POD Errors
The following errors were encountered while parsing the POD:
- Around line 13:
Unknown directive: =name
- Around line 21:
Unknown directive: =tagline
- Around line 29:
Unknown directive: =abstract
- Around line 37:
Unknown directive: =includes
- Around line 45:
Unknown directive: =synopsis
- Around line 74:
Unknown directive: =description
- Around line 83:
Unknown directive: =method
- Around line 89:
Unknown directive: =signature
- Around line 93:
Unknown directive: =metadata
- Around line 133:
=cut found outside a pod block. Skipping to next block.
- Around line 145:
Unknown directive: =partials