Commit | Line | Data |
2243a22b |
1 | |
2 | package Class::MOP::Module; |
3 | |
4 | use strict; |
5 | use warnings; |
6 | |
7 | use Scalar::Util 'blessed'; |
8 | |
2a755fe8 |
9 | our $VERSION = '0.64_05'; |
d519662a |
10 | $VERSION = eval $VERSION; |
f0480c45 |
11 | our $AUTHORITY = 'cpan:STEVAN'; |
2243a22b |
12 | |
13 | use base 'Class::MOP::Package'; |
14 | |
7f436b8c |
15 | sub version { |
16 | my $self = shift; |
8b49a472 |
17 | ${$self->get_package_symbol({ sigil => '$', type => 'SCALAR', name => 'VERSION' })}; |
7f436b8c |
18 | } |
19 | |
f0480c45 |
20 | sub authority { |
21 | my $self = shift; |
8b49a472 |
22 | ${$self->get_package_symbol({ sigil => '$', type => 'SCALAR', name => 'AUTHORITY' })}; |
f0480c45 |
23 | } |
9d6dce77 |
24 | |
f0480c45 |
25 | sub identifier { |
26 | my $self = shift; |
27 | join '-' => ( |
28 | $self->name, |
29 | ($self->version || ()), |
30 | ($self->authority || ()), |
31 | ); |
32 | } |
9d6dce77 |
33 | |
2243a22b |
34 | 1; |
35 | |
36 | __END__ |
37 | |
38 | =pod |
39 | |
40 | =head1 NAME |
41 | |
42 | Class::MOP::Module - Module Meta Object |
43 | |
2243a22b |
44 | =head1 DESCRIPTION |
45 | |
127d39a7 |
46 | This is an abstraction of a Perl 5 module, it is a superclass of |
47 | L<Class::MOP::Class>. A module essentially a package with metadata, |
48 | in our case the version and authority. |
49 | |
2243a22b |
50 | =head1 METHODS |
51 | |
52 | =over 4 |
53 | |
54 | =item B<meta> |
55 | |
127d39a7 |
56 | Returns a metaclass for this package. |
57 | |
58 | =item B<initialize ($package_name)> |
59 | |
60 | This will initialize a Class::MOP::Module instance which represents |
61 | the module of C<$package_name>. |
62 | |
7f436b8c |
63 | =item B<version> |
64 | |
b9d9fc0b |
65 | This is a read-only attribute which returns the C<$VERSION> of the |
66 | package for the given instance. |
67 | |
f0480c45 |
68 | =item B<authority> |
69 | |
b9d9fc0b |
70 | This is a read-only attribute which returns the C<$AUTHORITY> of the |
71 | package for the given instance. |
72 | |
f0480c45 |
73 | =item B<identifier> |
74 | |
96e38ba6 |
75 | This constructs a string of the name, version and authority. |
b9d9fc0b |
76 | |
2243a22b |
77 | =back |
78 | |
1a09d9cc |
79 | =head1 AUTHORS |
2243a22b |
80 | |
81 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
82 | |
83 | =head1 COPYRIGHT AND LICENSE |
84 | |
69e3ab0a |
85 | Copyright 2006-2008 by Infinity Interactive, Inc. |
2243a22b |
86 | |
87 | L<http://www.iinteractive.com> |
88 | |
89 | This library is free software; you can redistribute it and/or modify |
90 | it under the same terms as Perl itself. |
91 | |
ebce5539 |
92 | =cut |