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