8 use Scalar::Util 'blessed';
10 our $VERSION = '0.02';
16 my $metaclass = shift || 'Class::MOP::Class';
18 my $package = caller();
20 ($metaclass->isa('Class::MOP::Class'))
21 || confess 'The metaclass must be derived from Class::MOP::Class';
23 # create a meta object so we can install &meta
24 my $meta = $metaclass->initialize($package => %options);
25 $meta->add_method('meta' => sub {
26 # we must re-initialize so that it
27 # works as expected in subclasses,
28 # since metaclass instances are
29 # singletons, this is not really a
31 $metaclass->initialize((blessed($_[0]) || $_[0]) => %options)
43 metaclass - a pragma for installing and using Class::MOP metaclasses
49 # use Class::MOP::Class
52 # ... or use a custom metaclass
53 use metaclass 'MyMetaClass';
55 # ... or use a custom metaclass
56 # and custom attribute and method
58 use metaclass 'MyMetaClass' => (
59 ':attribute_metaclass' => 'MyAttributeMetaClass',
60 ':method_metaclass' => 'MyMethodMetaClass',
65 This is a pragma to make it easier to use a specific metaclass
66 and a set of custom attribute and method metaclasses. It also
67 installs a C<meta> method to your class as well.
71 Stevan Little E<lt>stevan@iinteractive.comE<gt>
73 =head1 COPYRIGHT AND LICENSE
75 Copyright 2006 by Infinity Interactive, Inc.
77 L<http://www.iinteractive.com>
79 This library is free software; you can redistribute it and/or modify
80 it under the same terms as Perl itself.