2 package Class::MOP::Module;
8 use Scalar::Util 'blessed';
10 our $VERSION = '0.79';
11 $VERSION = eval $VERSION;
12 our $AUTHORITY = 'cpan:STEVAN';
14 use base 'Class::MOP::Package';
18 ${$self->get_package_symbol({ sigil => '$', type => 'SCALAR', name => 'VERSION' })};
23 ${$self->get_package_symbol({ sigil => '$', type => 'SCALAR', name => 'AUTHORITY' })};
30 ($self->version || ()),
31 ($self->authority || ()),
36 my ( $class, %options ) = @_;
38 my $package_name = $options{package};
40 (defined $package_name && $package_name)
41 || confess "You must pass a package name";
43 my $code = "package $package_name;";
44 $code .= "\$$package_name\:\:VERSION = '" . $options{version} . "';"
45 if exists $options{version};
46 $code .= "\$$package_name\:\:AUTHORITY = '" . $options{authority} . "';"
47 if exists $options{authority};
50 confess "creation of $package_name failed : $@" if $@;
52 return; # XXX: should this return some kind of meta object? ~sartak
63 Class::MOP::Module - Module Meta Object
67 A module is essentially a L<Class::MOP::Package> with metadata, in our
68 case the version and authority.
72 B<Class::MOP::Module> is a subclass of L<Class::MOP::Package>.
78 =item B<< $metamodule->version >>
80 This is a read-only attribute which returns the C<$VERSION> of the
81 package, if one exists.
83 =item B<< $metamodule->authority >>
85 This is a read-only attribute which returns the C<$AUTHORITY> of the
86 package, if one exists.
88 =item B<< $metamodule->identifier >>
90 This constructs a string which combines the name, version and
93 =item B<< Class::MOP::Module->meta >>
95 This will return a L<Class::MOP::Class> instance for this class.
101 Stevan Little E<lt>stevan@iinteractive.comE<gt>
103 =head1 COPYRIGHT AND LICENSE
105 Copyright 2006-2009 by Infinity Interactive, Inc.
107 L<http://www.iinteractive.com>
109 This library is free software; you can redistribute it and/or modify
110 it under the same terms as Perl itself.