Commit | Line | Data |
82cfc049 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More tests => 1; |
7 | |
8 | BEGIN { |
b14c8df5 |
9 | use_ok('Moose::Policy'); |
10 | } |
11 | |
12 | { |
13 | package My::Moose::Meta::Attribute; |
14 | use Moose; |
15 | |
16 | extends 'Moose::Meta::Attribute'; |
17 | |
18 | before '_process_options' => sub { |
19 | my ($class, $name, $options) = @_; |
20 | if (exists $options->{is}) { |
21 | if ($options->{is} eq 'ro') { |
22 | $options->{reader} = 'get_' . $name; |
23 | } |
24 | elsif ($options->{is} eq 'rw') { |
25 | $options->{reader} = 'get_' . $name; |
26 | $options->{writer} = 'set_' . $name; |
27 | } |
28 | delete $options->{is}; |
29 | } |
30 | }; |
31 | } |
32 | |
33 | |
34 | { |
35 | package My::Moose::Policy; |
36 | |
37 | |
82cfc049 |
38 | } |