Commit | Line | Data |
---|---|---|
777fcfcf | 1 | use strictures 1; |
2 | use Test::More; | |
3 | use lib qw(t/lib); | |
4 | ||
5 | use_ok 'MooObjectWithDelegate'; | |
6 | ||
7 | { | |
8 | package MooObjectWithDelegate; | |
9 | use Moo; | |
10 | ||
11 | around 'connect', sub { | |
12 | my ($orig, $self, @args) = @_; | |
13 | return $self->$orig(@args) . 'c'; | |
14 | }; | |
15 | } | |
16 | ||
17 | ok my $moo_object = MooObjectWithDelegate->new, | |
18 | 'got object'; | |
19 | ||
20 | is $moo_object->connect, 'abc', | |
21 | 'got abc'; | |
22 | ||
23 | done_testing; |