2 package Class::MOP::Module;
8 use Scalar::Util 'blessed';
10 our $VERSION = '0.89';
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] : {@_};
23 # from Class::MOP::Package
24 package => $params->{package},
35 ${$self->get_package_symbol({ sigil => '$', type => 'SCALAR', name => 'VERSION' })};
40 ${$self->get_package_symbol({ sigil => '$', type => 'SCALAR', name => 'AUTHORITY' })};
47 ($self->version || ()),
48 ($self->authority || ()),
53 confess "The Class::MOP::Module->create method has been made a private object method.\n";
56 sub _instantiate_module {
57 my($self, $version, $authority) = @_;
58 my $package_name = $self->name;
60 Class::MOP::_is_valid_class_name($package_name)
61 || confess "creation of $package_name failed: invalid package name";
64 scalar %{$package_name . '::'}; # touch the stash
65 ${$package_name . '::VERSION'} = $version if defined $version;
66 ${$package_name . '::AUTHORITY'} = $authority if defined $authority;
79 Class::MOP::Module - Module Meta Object
83 A module is essentially a L<Class::MOP::Package> with metadata, in our
84 case the version and authority.
88 B<Class::MOP::Module> is a subclass of L<Class::MOP::Package>.
94 =item B<< $metamodule->version >>
96 This is a read-only attribute which returns the C<$VERSION> of the
97 package, if one exists.
99 =item B<< $metamodule->authority >>
101 This is a read-only attribute which returns the C<$AUTHORITY> of the
102 package, if one exists.
104 =item B<< $metamodule->identifier >>
106 This constructs a string which combines the name, version and
109 =item B<< Class::MOP::Module->meta >>
111 This will return a L<Class::MOP::Class> instance for this class.
117 Stevan Little E<lt>stevan@iinteractive.comE<gt>
119 =head1 COPYRIGHT AND LICENSE
121 Copyright 2006-2009 by Infinity Interactive, Inc.
123 L<http://www.iinteractive.com>
125 This library is free software; you can redistribute it and/or modify
126 it under the same terms as Perl itself.