line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Object::Role; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
289386
|
use 5.014; |
|
1
|
|
|
|
|
4
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use parent 'Moo::Role'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '2.01'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
1; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=encoding utf8 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Data::Object::Role |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 ABSTRACT |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Role Builder for Perl 5 |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
package Identity; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use Data::Object::Role; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
package Example; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use Moo; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
with 'Identity'; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
package main; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $example = Example->new; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 DESCRIPTION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This package modifies the consuming package making it a role. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 INHERITS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
This package inherits behaviors from: |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
L |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 SCENARIOS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This package supports the following scenarios: |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 has |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
package HasIdentity; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
use Data::Object::Role; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
has id => ( |
73
|
|
|
|
|
|
|
is => 'ro' |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
package HasExample; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
use Moo; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
with 'HasIdentity'; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
package main; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my $example = HasExample->new; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This package supports the C keyword, which is used to declare role |
87
|
|
|
|
|
|
|
attributes, which can be accessed and assigned to using the built-in |
88
|
|
|
|
|
|
|
getter/setter or by the object constructor. See L for more information. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 requires |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
package EntityRequires; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
use Data::Object::Role; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
requires 'execute'; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
package RequiresExample; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
use Moo; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
with 'EntityRequires'; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub execute { |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# does something ... |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
package main; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
my $example = RequiresExample->new; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This package supports the C keyword, which is used to declare methods |
116
|
|
|
|
|
|
|
which must exist in the consuming package. See L for more information. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 with |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
package WithEntity; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
use Data::Object::Role; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
package WithIdentity; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
use Data::Object::Role; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
with 'WithEntity'; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
package WithExample; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
use Moo; |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
with 'WithIdentity'; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
package main; |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
my $example = WithExample->new; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This package supports the C keyword, which is used to declare roles to be |
143
|
|
|
|
|
|
|
used and compose into your role. See L for more information. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=cut |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 AUTHOR |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Al Newkirk, C |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 LICENSE |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Copyright (C) 2011-2019, Al Newkirk, et al. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under the terms |
156
|
|
|
|
|
|
|
of the The Apache License, Version 2.0, as elucidated in the L<"license |
157
|
|
|
|
|
|
|
file"|https://github.com/iamalnewkirk/data-object-role/blob/master/LICENSE>. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 PROJECT |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
L |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
L |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
L |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
L |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
L |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
L |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=cut |