projects
/
gitmo/Moose.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
832f48bb36f614e462204093c14fe9833d5a4c28
[gitmo/Moose.git]
/
t
/
070_attribute_traits
/
209_trait_code.t
1
use strict;
2
use warnings;
3
4
use Test::More tests => 2;
5
6
{
7
package Thingy;
8
use Moose;
9
10
has callback => (
11
traits => ['Code'],
12
is => 'ro',
13
isa => 'CodeRef',
14
required => 1,
15
handles => { 'invoke_callback' => 'execute' },
16
);
17
}
18
19
my $i = 0;
20
my $thingy = Thingy->new(callback => sub { ++$i });
21
22
is($i, 0);
23
$thingy->invoke_callback;
24
is($i, 1);