File: method_proxy_args.t

package info (click to toggle)
libmoox-buildargs-perl 0.08-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 160 kB
  • sloc: perl: 300; makefile: 3
file content (26 lines) | stat: -rwxr-xr-x 404 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env perl
use 5.008001;
use strictures 2;
use Test2::V0;

{
    package Foo;
    use strictures 2;

    use Moo;
    with 'MooX::MethodProxyArgs';
    has bar => ( is=>'ro' );
}

$INC{'main.pm'} = 1;

sub divide {
    my ($class, $number, $divisor) = @_;
    return $number / $divisor;
}

my $foo = Foo->new( bar => ['&proxy', 'main', 'divide', 10, 2 ] );

is( $foo->bar(), 5 );

done_testing;