line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Role::Parameterized::Meta::Trait::Parameterized; |
2
|
|
|
|
|
|
|
# ABSTRACT: trait for parameterized roles |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.09'; |
5
|
|
|
|
|
|
|
|
6
|
27
|
|
|
27
|
|
13726
|
use Moose::Role; |
|
27
|
|
|
|
|
38
|
|
|
27
|
|
|
|
|
152
|
|
7
|
27
|
|
|
27
|
|
104293
|
use MooseX::Role::Parameterized::Parameters; |
|
27
|
|
|
|
|
77
|
|
|
27
|
|
|
|
|
1108
|
|
8
|
27
|
|
|
27
|
|
203
|
use Moose::Util 'find_meta'; |
|
27
|
|
|
|
|
38
|
|
|
27
|
|
|
|
|
226
|
|
9
|
27
|
|
|
27
|
|
18509
|
use namespace::autoclean; |
|
27
|
|
|
|
|
31655
|
|
|
27
|
|
|
|
|
103
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has genitor => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
does => 'MooseX::Role::Parameterized::Meta::Trait::Parameterizable', |
14
|
|
|
|
|
|
|
required => 1, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has parameters => ( |
18
|
|
|
|
|
|
|
is => 'rw', |
19
|
|
|
|
|
|
|
isa => 'MooseX::Role::Parameterized::Parameters', |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
around reinitialize => sub { |
23
|
|
|
|
|
|
|
my $orig = shift; |
24
|
|
|
|
|
|
|
my $class = shift; |
25
|
|
|
|
|
|
|
my ($pkg) = @_; |
26
|
|
|
|
|
|
|
my $meta = blessed($pkg) ? $pkg : find_meta($pkg); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $genitor = $meta->genitor; |
29
|
|
|
|
|
|
|
my $parameters = $meta->parameters; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $new = $class->$orig( |
32
|
|
|
|
|
|
|
@_, |
33
|
|
|
|
|
|
|
(defined($genitor) ? (genitor => $genitor) : ()), |
34
|
|
|
|
|
|
|
(defined($parameters) ? (parameters => $parameters) : ()), |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
# in case the role metaclass was reinitialized |
37
|
|
|
|
|
|
|
$MooseX::Role::Parameterized::CURRENT_METACLASS = $new; |
38
|
|
|
|
|
|
|
return $new; |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=pod |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=encoding UTF-8 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
MooseX::Role::Parameterized::Meta::Trait::Parameterized - trait for parameterized roles |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 VERSION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
version 1.09 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 DESCRIPTION |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This is the trait for parameterized roles; that is, parameterizable roles with |
60
|
|
|
|
|
|
|
their parameters bound. All this actually provides is a place to store the |
61
|
|
|
|
|
|
|
L<MooseX::Role::Parameterized::Parameters> object as well as the |
62
|
|
|
|
|
|
|
L<MooseX::Role::Parameterized::Meta::Role::Parameterizable> object that |
63
|
|
|
|
|
|
|
generated this role object. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=for stopwords genitor metaobject |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 genitor |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Returns the L<MooseX::Role::Parameterized::Meta::Role::Parameterizable> |
72
|
|
|
|
|
|
|
metaobject that generated this role. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 parameters |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Returns the L<MooseX::Role::Parameterized::Parameters> object that represents |
77
|
|
|
|
|
|
|
the specific parameter values for this parameterized role. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 SUPPORT |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Role-Parameterized> |
82
|
|
|
|
|
|
|
(or L<bug-MooseX-Role-Parameterized@rt.cpan.org|mailto:bug-MooseX-Role-Parameterized@rt.cpan.org>). |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
85
|
|
|
|
|
|
|
L<http://lists.perl.org/list/moose.html>. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
88
|
|
|
|
|
|
|
L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 AUTHOR |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Shawn M Moore <code@sartak.org> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This software is copyright (c) 2008 by Shawn M Moore. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
99
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |