Venus::Role::Deferrable
Deferrable Role
Deferrable Role for Perl 5
method: defer
package Example;
use Venus::Class;
with 'Venus::Role::Deferrable';
sub test {
my ($self, @args) = @_;
return $self->okay(@args);
}
sub okay {
my ($self, @args) = @_;
return [@args];
}
package main;
my $example = Example->new;
# my $code = $example->defer('test');
# sub {...}
# $code->();
# [...]
This package provides a mechanism for returning callbacks (i.e. closures) that dispatches method calls.
The defer method returns the named method as a callback (i.e. closure) which dispatches to the method call specified.
defer(Str $method, Any @args) (CodeRef)
{ since => '1.80', }
=example-1 defer
# given: synopsis
package main;
$example = Example->new;
# bless({}, 'Example1')
# my $result = $example->defer('test', 1..4);
# $result->();
# [1..4]
t/Venus.t: pdml: authors t/Venus.t: pdml: license
11 POD Errors
The following errors were encountered while parsing the POD:
- Around line 15:
Unknown directive: =name
- Around line 23:
Unknown directive: =tagline
- Around line 31:
Unknown directive: =abstract
- Around line 39:
Unknown directive: =includes
- Around line 47:
Unknown directive: =synopsis
- Around line 93:
Unknown directive: =description
- Around line 102:
Unknown directive: =method
- Around line 107:
Unknown directive: =signature
- Around line 111:
Unknown directive: =metadata
- Around line 161:
=cut found outside a pod block. Skipping to next block.
- Around line 173:
Unknown directive: =partials