MooseX::Role::Restricted - (DEPRECATED) Restrict which sub are exported by a role
package MyApp::MyRole; use MooseX::Role::Restricted; sub method1 { ... } sub _private1 { ... } sub _method2 :Public { ... } sub private2 :Private { ... }
This module is no longer supported. I suggest looking at namespace::autoclean as an alternative. In its default form MooseX::Role::Restricted simple excludes ann sub with names starting with _ to be excluded. This can be accomplished using
_
use namespace::autoclean -also => qr/^_/;
If you are using lazy_build or other Moose features that require the use of _ prefixed methods make sure to change the pattern to not match those. Or use some other prefix, for example a double _, for your private subs that you do not want included in the role.
lazy_build
By default Moose::Role will export any sub you define in a role package. However it does not export any sub which was imported from another package
MooseX::Role::Restricted give a little more control over which subs are exported and which are not.
By default an sub with a name starting with _ is considered private and will not be exported. However MooseX::Role::Restricted provides two subroutine attributes :Public and :Private which can control is any sub is exported or kept private
:Public
:Private
Moose::Role
Graham Barr <gbarr@cpan.org>
Copyright (C) 2009 Graham Barr
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install MooseX::Role::Restricted, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::Role::Restricted
CPAN shell
perl -MCPAN -e shell install MooseX::Role::Restricted
For more information on module installation, please visit the detailed CPAN module installation guide.