package Moose::Policy;
+use Moose 'confess', 'blessed';
-use strict;
-use warnings;
-
-our $VERSION = '0.01';
-
-use Moose ();
-use Carp 'confess';
-use Scalar::Util 'blessed';
+our $VERSION = '0.03';
+our $AUTHORITY = 'cpan:STEVAN';
sub import {
shift;
my $policy = shift || return;
- unless (Moose::_is_class_already_loaded($policy)) {
- ($policy->require) or confess "Could not load policy module " .
- "'$policy' because : $UNIVERSAL::require::ERROR";
+ unless (Class::MOP::is_class_loaded($policy)) {
+ # otherwise require it ...
+ eval { Class::MOP::load_class($policy) };
+ confess "Could not load policy module '$policy' because : $@"
+ if $@;
}
my $package = caller();
my %options;
# build options out of policy's constants
- $policy->can($_) and $options{":$_"} = $policy->$_($package)
+ $policy->can($_) and $options{"$_"} = $policy->$_($package)
for (qw(
attribute_metaclass
instance_metaclass
=head1 NAME
-Moose::Policy - moose-mounted police
+Moose::Policy - Moose-mounted police
=head1 SYNOPSIS
removes most of that hairiness and makes it possible to cleanly contain
a set of meta-level customizations in one easy to use module.
-This is the first release of this module and should be considered to be
-complete by any means. It is very basic implemenation at this point and
+This is still an release of this module and it should not be considered to
+be complete by any means. It is very basic implemenation at this point and
will likely get more feature-full over time, as people request features.
So if you have a suggestion/need/idea, please speak up.
Moose class.
For instance, L<Moose::Policy::SingleInheritence> enforces that all
-specified Moose classes can only use single inheritence. It does this
+specified Moose classes can only use single inheritance. It does this
by trapping the call to C<superclasses> on the metaclass and only allowing
you to assign a single superclass.
you try to set a Moose::Policy and there is a C<meta> method available,
not only will kittens die, but your program will too.
-=head2 Policys are class scoped
+=head2 Policies are class scoped
-You must repeat the policy for each class you want to us it. It is B<not>
+You must repeat the policy for each class you want to use it. It is B<not>
inherited. This may change in the future, probably it will be a Moose::Policy
-itself to allow Moose policys to be inherited.
+itself to allow Moose policies to be inherited.
=head1 THE POLICY
C<Moose::Policy::> and the test suite. More docs to come on this later (probably
a cookbook or something).
+=head1 METHODS
+
+=over 4
+
+=item B<meta>
+
+=back
+
=head1 FUTURE PLANS
As I said above, this is the first release and it is by no means feature complete.
Roles are an excellent way to combine sets of behaviors together into one, and
custom metaclasses are actually better composed by roles then by inheritence.
The ideal situation is that this module will provide a set of roles which can be
-used to compose you meta-policy with relative ease.
+used to compose your meta-policy with relative ease.
=back
Stevan Little E<lt>stevan@iinteractive.comE<gt>
-Eric Wilhelm E<lt>...E<gt>
+Eric Wilhelm
=head1 COPYRIGHT AND LICENSE
-Copyright 2006 by Infinity Interactive, Inc.
+Copyright 2006-2007 by Infinity Interactive, Inc.
L<http://www.iinteractive.com>