fixing the authors lists and adding the ClassName type constraint
[gitmo/Class-MOP.git] / lib / Class / MOP / Module.pm
CommitLineData
2243a22b 1
2package Class::MOP::Module;
3
4use strict;
5use warnings;
6
7use Scalar::Util 'blessed';
8
9d6dce77 9our $VERSION = '0.02';
f0480c45 10our $AUTHORITY = 'cpan:STEVAN';
2243a22b 11
12use base 'Class::MOP::Package';
13
14# introspection
15
16sub meta {
17 require Class::MOP::Class;
18 Class::MOP::Class->initialize(blessed($_[0]) || $_[0]);
19}
20
7f436b8c 21sub version {
22 my $self = shift;
58d75218 23 ${$self->get_package_symbol('$VERSION')};
7f436b8c 24}
25
f0480c45 26sub authority {
27 my $self = shift;
28 ${$self->get_package_symbol('$AUTHORITY')};
29}
9d6dce77 30
f0480c45 31sub identifier {
32 my $self = shift;
33 join '-' => (
34 $self->name,
35 ($self->version || ()),
36 ($self->authority || ()),
37 );
38}
9d6dce77 39
2243a22b 401;
41
42__END__
43
44=pod
45
46=head1 NAME
47
48Class::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
b9d9fc0b 62This is a read-only attribute which returns the C<$VERSION> of the
63package for the given instance.
64
f0480c45 65=item B<authority>
66
b9d9fc0b 67This is a read-only attribute which returns the C<$AUTHORITY> of the
68package for the given instance.
69
f0480c45 70=item B<identifier>
71
96e38ba6 72This constructs a string of the name, version and authority.
b9d9fc0b 73
2243a22b 74=back
75
1a09d9cc 76=head1 AUTHORS
2243a22b 77
78Stevan Little E<lt>stevan@iinteractive.comE<gt>
79
80=head1 COPYRIGHT AND LICENSE
81
2367814a 82Copyright 2006, 2007 by Infinity Interactive, Inc.
2243a22b 83
84L<http://www.iinteractive.com>
85
86This library is free software; you can redistribute it and/or modify
87it under the same terms as Perl itself.
88
89=cut