Venus::Role::Proxyable

Proxyable Role

Proxyable Role for Perl 5

method: build_proxy

package Example;

use Venus::Class;

with 'Venus::Role::Proxyable';

attr 'test';

sub build_proxy {
  my ($self, $package, $method, @args) = @_;
  return sub { [$self, $package, $method, @args] } if $method eq 'anything';
  return undef;
}

package main;

my $example = Example->new(test => time);

# $example->anything(1..4);

This package provides a hook into method dispatch resoluton via a wrapper around the AUTOLOAD routine which processes calls to routines which don't exist.

The build_proxy method should return a code reference to fulfill the method dispatching request, or undef to result in a method not found error.

build_proxy(Str $package, Str $method, Any @args) (CodeRef | Undef)

{ since => '0.01', }

=example-1 build_proxy

package main;

my $example = Example->new(test => 123);

my $build_proxy = $example->build_proxy('Example', 'everything', 1..4);

# undef

t/Venus.t: pdml: authors t/Venus.t: pdml: 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 86:

Unknown directive: =description

Around line 96:

Unknown directive: =method

Around line 101:

Unknown directive: =signature

Around line 105:

Unknown directive: =metadata

Around line 141:

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

Around line 159:

Unknown directive: =partials