2 package Class::MOP::Module;
8 use Scalar::Util 'blessed';
10 use base 'Class::MOP::Package';
14 return Class::MOP::Class->initialize($class)->new_object(@_)
15 if $class ne __PACKAGE__;
17 my $params = @_ == 1 ? $_[0] : {@_};
20 # from Class::MOP::Package
21 package => $params->{package},
32 ${$self->get_or_add_package_symbol('$VERSION')};
37 ${$self->get_or_add_package_symbol('$AUTHORITY')};
44 ($self->version || ()),
45 ($self->authority || ()),
50 confess "The Class::MOP::Module->create method has been made a private object method.\n";
53 sub _instantiate_module {
54 my($self, $version, $authority) = @_;
55 my $package_name = $self->name;
57 Class::MOP::_is_valid_class_name($package_name)
58 || confess "creation of $package_name failed: invalid package name";
61 scalar %{ $package_name . '::' }; # touch the stash
62 ${ $package_name . '::VERSION' } = $version if defined $version;
63 ${ $package_name . '::AUTHORITY' } = $authority if defined $authority;
70 # ABSTRACT: Module Meta Object
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.