line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::SemiAffordanceAccessor::Role::Attribute; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
2
|
|
|
2
|
|
48
|
$MooseX::SemiAffordanceAccessor::Role::Attribute::VERSION = '0.09'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
61
|
|
7
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
49
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
1844
|
use Moose::Role; |
|
2
|
|
|
|
|
6265
|
|
|
2
|
|
|
|
|
18
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
before '_process_options' => sub { |
12
|
|
|
|
|
|
|
my $class = shift; |
13
|
|
|
|
|
|
|
my $name = shift; |
14
|
|
|
|
|
|
|
my $options = shift; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
if ( exists $options->{is} |
17
|
|
|
|
|
|
|
&& !( exists $options->{reader} || exists $options->{writer} ) ) { |
18
|
|
|
|
|
|
|
if ( $options->{is} eq 'ro' ) { |
19
|
|
|
|
|
|
|
$options->{reader} = $name; |
20
|
|
|
|
|
|
|
delete $options->{is}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
elsif ( $options->{is} eq 'rw' ) { |
23
|
|
|
|
|
|
|
$options->{reader} = $name; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $prefix = 'set'; |
26
|
|
|
|
|
|
|
if ( $name =~ s/^_// ) { |
27
|
|
|
|
|
|
|
$prefix = '_set'; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$options->{writer} = $prefix . q{_} . $name; |
31
|
|
|
|
|
|
|
delete $options->{is}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
2
|
|
14051
|
no Moose::Role; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
11
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |
43
|
|
|
|
|
|
|
=pod |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
MooseX::SemiAffordanceAccessor::Role::Attribute |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 VERSION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
version 0.09 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SYNOPSIS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Moose::Util::MetaRole::apply_metaclass_roles( |
56
|
|
|
|
|
|
|
for_class => $p{for_class}, |
57
|
|
|
|
|
|
|
attribute_metaclass_roles => |
58
|
|
|
|
|
|
|
['MooseX::SemiAffordanceAccessor::Role::Attribute'], |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This role applies a method modifier to the C<_process_options()> |
64
|
|
|
|
|
|
|
method, and tweaks the reader and writer parameters so that they |
65
|
|
|
|
|
|
|
follow the semi-affordance naming style. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This software is Copyright (c) 2011 by Dave Rolsky. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This is free software, licensed under: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|