use strict;
use warnings;
-use Carp 'confess';
+use Carp 'confess';
+use Scalar::Util 'blessed';
-our $VERSION = '0.01';
+our $VERSION = '0.02';
use Class::MOP;
sub import {
shift;
- my $metaclass = shift;
+ my $metaclass = shift || 'Class::MOP::Class';
my %options = @_;
my $package = caller();
# since metaclass instances are
# singletons, this is not really a
# big deal anyway.
- $metaclass->initialize($_[0] => %options)
+ $metaclass->initialize((blessed($_[0]) || $_[0]) => %options)
});
}
=head1 SYNOPSIS
+ package MyClass;
+
+ # use Class::MOP::Class
+ use metaclass;
+
+ # ... or use a custom metaclass
use metaclass 'MyMetaClass';
+ # ... or use a custom metaclass
+ # and custom attribute and method
+ # metaclasses
use metaclass 'MyMetaClass' => (
':attribute_metaclass' => 'MyAttributeMetaClass',
':method_metaclass' => 'MyMethodMetaClass',
=head1 DESCRIPTION
+This is a pragma to make it easier to use a specific metaclass
+and a set of custom attribute and method metaclasses. It also
+installs a C<meta> method to your class as well.
+
=head1 AUTHOR
Stevan Little E<lt>stevan@iinteractive.comE<gt>