line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::MOP::Module; |
2
|
|
|
|
|
|
|
our $VERSION = '2.2203'; |
3
|
|
|
|
|
|
|
|
4
|
462
|
|
|
462
|
|
186812
|
use strict; |
|
462
|
|
|
|
|
914
|
|
|
462
|
|
|
|
|
12005
|
|
5
|
462
|
|
|
462
|
|
2021
|
use warnings; |
|
462
|
|
|
|
|
800
|
|
|
462
|
|
|
|
|
11022
|
|
6
|
|
|
|
|
|
|
|
7
|
462
|
|
|
462
|
|
2084
|
use parent 'Class::MOP::Package'; |
|
462
|
|
|
|
|
842
|
|
|
462
|
|
|
|
|
2286
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub _new { |
10
|
1
|
|
|
1
|
|
2
|
my $class = shift; |
11
|
1
|
50
|
|
|
|
10
|
return Class::MOP::Class->initialize($class)->new_object(@_) |
12
|
|
|
|
|
|
|
if $class ne __PACKAGE__; |
13
|
|
|
|
|
|
|
|
14
|
0
|
0
|
|
|
|
0
|
my $params = @_ == 1 ? $_[0] : {@_}; |
15
|
|
|
|
|
|
|
return bless { |
16
|
|
|
|
|
|
|
# Need to quote package to avoid a problem with PPI mis-parsing this |
17
|
|
|
|
|
|
|
# as a package statement. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# from Class::MOP::Package |
20
|
|
|
|
|
|
|
'package' => $params->{package}, |
21
|
0
|
|
|
|
|
0
|
namespace => \undef, |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# attributes |
24
|
|
|
|
|
|
|
version => \undef, |
25
|
|
|
|
|
|
|
authority => \undef |
26
|
|
|
|
|
|
|
} => $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub version { |
30
|
12
|
|
|
12
|
|
6232
|
my $self = shift; |
31
|
12
|
|
|
|
|
21
|
${$self->get_or_add_package_symbol('$VERSION')}; |
|
12
|
|
|
|
|
64
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub authority { |
35
|
8
|
|
|
8
|
|
18
|
my $self = shift; |
36
|
8
|
|
|
|
|
11
|
${$self->get_or_add_package_symbol('$AUTHORITY')}; |
|
8
|
|
|
|
|
18
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub identifier { |
40
|
5
|
|
|
5
|
1
|
853
|
my $self = shift; |
41
|
5
|
|
66
|
|
|
31
|
join '-' => ( |
|
|
|
66
|
|
|
|
|
42
|
|
|
|
|
|
|
$self->name, |
43
|
|
|
|
|
|
|
($self->version || ()), |
44
|
|
|
|
|
|
|
($self->authority || ()), |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub create { |
49
|
1537
|
|
|
1537
|
1
|
4402
|
my $class = shift; |
50
|
1537
|
|
|
|
|
3859
|
my @args = @_; |
51
|
|
|
|
|
|
|
|
52
|
1537
|
50
|
|
|
|
7980
|
unshift @args, 'package' if @args % 2 == 1; |
53
|
1537
|
|
|
|
|
4298
|
my %options = @args; |
54
|
|
|
|
|
|
|
|
55
|
1537
|
|
|
|
|
3236
|
my $package = delete $options{package}; |
56
|
1537
|
|
|
|
|
5841
|
my $version = delete $options{version}; |
57
|
1537
|
|
|
|
|
2907
|
my $authority = delete $options{authority}; |
58
|
|
|
|
|
|
|
|
59
|
1537
|
|
|
|
|
11084
|
my $meta = $class->SUPER::create($package => %options); |
60
|
|
|
|
|
|
|
|
61
|
1532
|
|
|
|
|
8033
|
$meta->_instantiate_module($version, $authority); |
62
|
|
|
|
|
|
|
|
63
|
1532
|
|
|
|
|
6640
|
return $meta; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
|
0
|
sub _anon_package_prefix { 'Class::MOP::Module::__ANON__::SERIAL::' } |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub _anon_cache_key { |
69
|
1
|
|
|
1
|
|
3
|
my $class = shift; |
70
|
1
|
|
|
|
|
3
|
my %options = @_; |
71
|
1
|
|
|
|
|
12
|
$class->_throw_exception( PackagesAndModulesAreNotCachable => class_name => $class, |
72
|
|
|
|
|
|
|
params => \%options, |
73
|
|
|
|
|
|
|
is_module => 1 |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub _instantiate_module { |
78
|
1532
|
|
|
1532
|
|
3907
|
my($self, $version, $authority) = @_; |
79
|
1532
|
|
|
|
|
7313
|
my $package_name = $self->name; |
80
|
|
|
|
|
|
|
|
81
|
1532
|
100
|
|
|
|
8084
|
$self->add_package_symbol('$VERSION' => $version) |
82
|
|
|
|
|
|
|
if defined $version; |
83
|
1532
|
100
|
|
|
|
4999
|
$self->add_package_symbol('$AUTHORITY' => $authority) |
84
|
|
|
|
|
|
|
if defined $authority; |
85
|
|
|
|
|
|
|
|
86
|
1532
|
|
|
|
|
15837
|
return; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# ABSTRACT: Module Meta Object |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=pod |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=encoding UTF-8 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 NAME |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Class::MOP::Module - Module Meta Object |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 VERSION |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
version 2.2203 |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 DESCRIPTION |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
A module is essentially a L<Class::MOP::Package> with metadata, in our |
110
|
|
|
|
|
|
|
case the version and authority. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 INHERITANCE |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
B<Class::MOP::Module> is a subclass of L<Class::MOP::Package>. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 METHODS |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 Class::MOP::Module->create($package, %options) |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Overrides C<create> from L<Class::MOP::Package> to provide these additional |
121
|
|
|
|
|
|
|
options: |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=over 4 |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item C<version> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
A version number, to be installed in the C<$VERSION> package global variable. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item C<authority> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
An authority, to be installed in the C<$AUTHORITY> package global variable. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This is a legacy field and its use is not recommended. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=back |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 $metamodule->version |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
This is a read-only attribute which returns the C<$VERSION> of the |
140
|
|
|
|
|
|
|
package, if one exists. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 $metamodule->authority |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This is a read-only attribute which returns the C<$AUTHORITY> of the |
145
|
|
|
|
|
|
|
package, if one exists. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 $metamodule->identifier |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This constructs a string which combines the name, version and |
150
|
|
|
|
|
|
|
authority. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 Class::MOP::Module->meta |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This will return a L<Class::MOP::Class> instance for this class. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 AUTHORS |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=over 4 |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Stevan Little <stevan@cpan.org> |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Jesse Luehrs <doy@cpan.org> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item * |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Shawn M Moore <sartak@cpan.org> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item * |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org> |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Hans Dieter Pearcey <hdp@cpan.org> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item * |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Chris Prather <chris@prather.org> |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item * |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Matt S Trout <mstrout@cpan.org> |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=back |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
This software is copyright (c) 2006 by Infinity Interactive, Inc. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
207
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=cut |