Leaving Moose Entering MooseX
Well things are progressing for me. You might remember a resent post of mine where I badly injured my Perl and another post where I started down the road of healing. Well today I finally wrote my first MooseX a variation on MooseX::Authorized Methods which rather that using some sort of 'User' who has some sort of 'role' method I just set it up so the class instance must have at least one 'Role' to use the method.
Now I make no apologies here all I really did was copy out Daniel's make a few changes in the name spaces and have my own default verifier.
So now instead of
MooseX::AuthorizedMethods
MooseX::Meta::Method::Authorized
MooseX::Meta::Method::Authorized::CheckRoles
MooseX::Meta::Method::Authorized::Application::ToClass
MooseX::Meta::Method::Authorized::Application::ToComposite
MooseX::Meta::Method::Authorized::Application::ToInstance
MooseX::Meta::Method::Authorized::Meta::Role
I have
MooseX::AuthorizedMethodRoles
MooseX::Meta::Method::Role::Authorized
MooseX::Meta::Method::Role::Authorized::HasRoles
MooseX::Meta::Method::Role::Authorized::Application::ToClass
MooseX::Meta::Method::Role::Authorized::Application::ToComposite
MooseX::Meta::Method::Role::Authorized::Application::ToInstance
MooseX::Meta::Method::Role::Authorized::Meta::Role
And I express "authorized_roles" as the declarator rather than 'authorized'
So now my code looks like this
package Product::Moves;
use MooseX::AuthorizedMethodRoles;
...
authorized_roles bin_swap => [qw(Product::BRULE::Bin ], sub {
...
Now that that was completed I reinstalled 'MooseX::Authorized Methods' and de-broke my Perl.
Now there is a good deal of extra in the new namespace I do not need and I do not think is useful, as well I do not have any tests or POD written up and I still have to create a Make file and all that fun stuff.
But at least I am on my way to creating my first MooseX. Now I wonder if anyone else will find this useful or has a suggestion for a better namespace??
Maybe MooseX::CheckCallerRoles?