2 package Class::MOP::Module;
8 use Scalar::Util 'blessed';
10 our $VERSION = '0.92';
11 $VERSION = eval $VERSION;
12 our $AUTHORITY = 'cpan:STEVAN';
14 use base 'Class::MOP::Package';
18 return Class::MOP::Class->initialize($class)->new_object(@_)
19 if $class ne __PACKAGE__;
21 my $params = @_ == 1 ? $_[0] : {@_};
24 # from Class::MOP::Package
25 package => $params->{package},
36 ${$self->get_package_symbol('$VERSION', create => 1)};
41 ${$self->get_package_symbol('$AUTHORITY', create => 1)};
48 ($self->version || ()),
49 ($self->authority || ()),
54 confess "The Class::MOP::Module->create method has been made a private object method.\n";
57 sub _instantiate_module {
58 my($self, $version, $authority) = @_;
59 my $package_name = $self->name;
61 Class::MOP::_is_valid_class_name($package_name)
62 || confess "creation of $package_name failed: invalid package name";
64 ${ $self->get_package_symbol('$VERSION', create => 1) } = $version;
65 ${ $self->get_package_symbol('$AUTHORITY', create => 1) } = $authority;
78 Class::MOP::Module - Module Meta Object
82 A module is essentially a L<Class::MOP::Package> with metadata, in our
83 case the version and authority.
87 B<Class::MOP::Module> is a subclass of L<Class::MOP::Package>.
93 =item B<< $metamodule->version >>
95 This is a read-only attribute which returns the C<$VERSION> of the
96 package, if one exists.
98 =item B<< $metamodule->authority >>
100 This is a read-only attribute which returns the C<$AUTHORITY> of the
101 package, if one exists.
103 =item B<< $metamodule->identifier >>
105 This constructs a string which combines the name, version and
108 =item B<< Class::MOP::Module->meta >>
110 This will return a L<Class::MOP::Class> instance for this class.
116 Stevan Little E<lt>stevan@iinteractive.comE<gt>
118 =head1 COPYRIGHT AND LICENSE
120 Copyright 2006-2009 by Infinity Interactive, Inc.
122 L<http://www.iinteractive.com>
124 This library is free software; you can redistribute it and/or modify
125 it under the same terms as Perl itself.