Commit | Line | Data |
---|---|---|
2243a22b | 1 | |
2 | package Class::MOP::Module; | |
3 | ||
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | use Scalar::Util 'blessed'; | |
8 | ||
9d6dce77 | 9 | our $VERSION = '0.02'; |
f0480c45 | 10 | our $AUTHORITY = 'cpan:STEVAN'; |
2243a22b | 11 | |
12 | use base 'Class::MOP::Package'; | |
13 | ||
14 | # introspection | |
15 | ||
16 | sub meta { | |
17 | require Class::MOP::Class; | |
18 | Class::MOP::Class->initialize(blessed($_[0]) || $_[0]); | |
19 | } | |
20 | ||
7f436b8c | 21 | sub version { |
22 | my $self = shift; | |
58d75218 | 23 | ${$self->get_package_symbol('$VERSION')}; |
7f436b8c | 24 | } |
25 | ||
f0480c45 | 26 | sub authority { |
27 | my $self = shift; | |
28 | ${$self->get_package_symbol('$AUTHORITY')}; | |
29 | } | |
9d6dce77 | 30 | |
f0480c45 | 31 | sub identifier { |
32 | my $self = shift; | |
33 | join '-' => ( | |
34 | $self->name, | |
35 | ($self->version || ()), | |
36 | ($self->authority || ()), | |
37 | ); | |
38 | } | |
9d6dce77 | 39 | |
2243a22b | 40 | 1; |
41 | ||
42 | __END__ | |
43 | ||
44 | =pod | |
45 | ||
46 | =head1 NAME | |
47 | ||
48 | Class::MOP::Module - Module Meta Object | |
49 | ||
50 | =head1 SYNOPSIS | |
51 | ||
52 | =head1 DESCRIPTION | |
53 | ||
54 | =head1 METHODS | |
55 | ||
56 | =over 4 | |
57 | ||
58 | =item B<meta> | |
59 | ||
7f436b8c | 60 | =item B<version> |
61 | ||
f0480c45 | 62 | =item B<authority> |
63 | ||
64 | =item B<identifier> | |
65 | ||
2243a22b | 66 | =back |
67 | ||
1a09d9cc | 68 | =head1 AUTHORS |
2243a22b | 69 | |
70 | Stevan Little E<lt>stevan@iinteractive.comE<gt> | |
71 | ||
1a09d9cc | 72 | Yuval Kogman E<lt>nothingmuch@woobling.comE<gt> |
73 | ||
2243a22b | 74 | =head1 COPYRIGHT AND LICENSE |
75 | ||
76 | Copyright 2006 by Infinity Interactive, Inc. | |
77 | ||
78 | L<http://www.iinteractive.com> | |
79 | ||
80 | This library is free software; you can redistribute it and/or modify | |
81 | it under the same terms as Perl itself. | |
82 | ||
83 | =cut |