| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MooseX::ClassAttribute::Trait::Application::ToClass; |
|
2
|
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
30
|
use strict; |
|
|
8
|
|
|
|
|
14
|
|
|
|
8
|
|
|
|
|
229
|
|
|
4
|
8
|
|
|
8
|
|
32
|
use warnings; |
|
|
8
|
|
|
|
|
13
|
|
|
|
8
|
|
|
|
|
375
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.29'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
8
|
|
|
8
|
|
32
|
use namespace::autoclean; |
|
|
8
|
|
|
|
|
9
|
|
|
|
8
|
|
|
|
|
51
|
|
|
9
|
8
|
|
|
8
|
|
373
|
use Moose::Role; |
|
|
8
|
|
|
|
|
9
|
|
|
|
8
|
|
|
|
|
42
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with 'MooseX::ClassAttribute::Trait::Application'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
around apply => sub { |
|
14
|
|
|
|
|
|
|
my $orig = shift; |
|
15
|
|
|
|
|
|
|
my $self = shift; |
|
16
|
|
|
|
|
|
|
my $role = shift; |
|
17
|
|
|
|
|
|
|
my $class = shift; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$class = Moose::Util::MetaRole::apply_metaroles( |
|
20
|
|
|
|
|
|
|
for => $class, |
|
21
|
|
|
|
|
|
|
class_metaroles => { |
|
22
|
|
|
|
|
|
|
class => ['MooseX::ClassAttribute::Trait::Class'], |
|
23
|
|
|
|
|
|
|
}, |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$self->$orig( $role, $class ); |
|
27
|
|
|
|
|
|
|
}; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _apply_class_attributes { |
|
30
|
7
|
|
|
7
|
|
12
|
my $self = shift; |
|
31
|
7
|
|
|
|
|
10
|
my $role = shift; |
|
32
|
7
|
|
|
|
|
9
|
my $class = shift; |
|
33
|
|
|
|
|
|
|
|
|
34
|
7
|
|
|
|
|
16
|
my $attr_metaclass = $class->attribute_metaclass(); |
|
35
|
|
|
|
|
|
|
|
|
36
|
7
|
|
|
|
|
304
|
foreach my $attribute_name ( $role->get_class_attribute_list() ) { |
|
37
|
39
|
50
|
33
|
|
|
1541
|
if ( $class->has_class_attribute($attribute_name) |
|
38
|
|
|
|
|
|
|
&& $class->get_class_attribute($attribute_name) |
|
39
|
|
|
|
|
|
|
!= $role->get_class_attribute($attribute_name) ) { |
|
40
|
0
|
|
|
|
|
0
|
next; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
else { |
|
43
|
39
|
|
|
|
|
1489
|
$class->add_class_attribute( |
|
44
|
|
|
|
|
|
|
$role->get_class_attribute($attribute_name) |
|
45
|
|
|
|
|
|
|
->attribute_for_class($attr_metaclass) ); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# ABSTRACT: A trait that supports applying class attributes to classes |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=pod |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=encoding UTF-8 |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NAME |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
MooseX::ClassAttribute::Trait::Application::ToClass - A trait that supports applying class attributes to classes |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 VERSION |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
version 0.29 |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This trait is used to allow the application of roles containing class |
|
71
|
|
|
|
|
|
|
attributes to classes. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 BUGS |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
See L<MooseX::ClassAttribute> for details. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|http://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-ClassAttribute> |
|
78
|
|
|
|
|
|
|
(or L<bug-moosex-classattribute@rt.cpan.org|mailto:bug-moosex-classattribute@rt.cpan.org>). |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
I am also usually active on IRC as 'drolsky' on C<irc://irc.perl.org>. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 AUTHOR |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This software is Copyright (c) 2016 by Dave Rolsky. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This is free software, licensed under: |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |