X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FPolicy.pm;h=ebc704f6c2e1c0481d583680cf787cf436ec747c;hb=3d1dec0aeed65b0c5d61de697ee1250f22ab2a75;hp=4c4e1cbe1482a25251428305e030e93bb3884948;hpb=1c037baf68ddfaea08190bf651dc249e79a35092;p=gitmo%2FMoose-Policy.git diff --git a/lib/Moose/Policy.pm b/lib/Moose/Policy.pm index 4c4e1cb..ebc704f 100644 --- a/lib/Moose/Policy.pm +++ b/lib/Moose/Policy.pm @@ -1,22 +1,19 @@ 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.04'; +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(); @@ -30,7 +27,7 @@ sub import { 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 @@ -55,7 +52,7 @@ __END__ =head1 NAME -Moose::Policy - moose-mounted police +Moose::Policy - Moose-mounted police =head1 SYNOPSIS @@ -69,6 +66,14 @@ Moose::Policy - moose-mounted police # Foo now has (get, set)_bar methods as well as get_baz +=head1 DEPRECATION NOTICE + +B. + +L replaces the L module. The +other policies included in this distribution do not yet have standalone MooseX +modules, as of November, 2010. + =head1 DESCRIPTION This module allows you to specify your project-wide or even company-wide @@ -79,7 +84,7 @@ metaclasses, however fiddling with the metaclasses can be hairy. Moose::Policy 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 it should not be considered to +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. @@ -91,7 +96,7 @@ implement a number of customizations and restrictions on a particular Moose class. For instance, L 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 on the metaclass and only allowing you to assign a single superclass. @@ -115,15 +120,15 @@ custom metaclass before Moose has set it's default metaclass. In fact, if you try to set a Moose::Policy and there is a C 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 +You must repeat the policy for each class you want to use it. It is B 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 -A Policy is set by passing C a package name. This +A Policy is set by passing C a package name. This package is then queried for what metaclasses it should use. The possible metaclass values are: @@ -145,6 +150,14 @@ For examples of what a Policy actually looks like see the examples in C and the test suite. More docs to come on this later (probably a cookbook or something). +=head1 METHODS + +=over 4 + +=item B + +=back + =head1 FUTURE PLANS As I said above, this is the first release and it is by no means feature complete. @@ -158,7 +171,7 @@ some random thoughts on that, in no particular order. 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 @@ -172,11 +185,11 @@ to cpan-RT. Stevan Little Estevan@iinteractive.comE -Eric Wilhelm E...E +Eric Wilhelm =head1 COPYRIGHT AND LICENSE -Copyright 2006 by Infinity Interactive, Inc. +Copyright 2006-2007 by Infinity Interactive, Inc. L