15 my $metaclass = shift || 'Class::MOP::Class';
17 my $package = caller();
19 ($metaclass->isa('Class::MOP::Class'))
20 || confess 'The metaclass must be derived from Class::MOP::Class';
22 # create a meta object so we can install &meta
23 my $meta = $metaclass->initialize($package => %options);
24 $meta->add_method('meta' => sub {
25 # we must re-initialize so that it
26 # works as expected in subclasses,
27 # since metaclass instances are
28 # singletons, this is not really a
30 $metaclass->initialize($_[0] => %options)
42 metaclass - a pragma for installing using Class::MOP metaclasses
48 # use Class::MOP::Class
51 # ... or use a custom metaclass
52 use metaclass 'MyMetaClass';
54 # ... or use a custom metaclass
55 # and custom attribute and method
57 use metaclass 'MyMetaClass' => (
58 ':attribute_metaclass' => 'MyAttributeMetaClass',
59 ':method_metaclass' => 'MyMethodMetaClass',
64 This is a pragma to make it easier to use a specific metaclass
65 and a set of custom attribute and method metaclasses. It also
66 installs a C<meta> method to your class as well.
70 Stevan Little E<lt>stevan@iinteractive.comE<gt>
72 =head1 COPYRIGHT AND LICENSE
74 Copyright 2006 by Infinity Interactive, Inc.
76 L<http://www.iinteractive.com>
78 This library is free software; you can redistribute it and/or modify
79 it under the same terms as Perl itself.