Graham Barr > MooseX-Role-Restricted-1.03 > MooseX::Role::Restricted

Download:
MooseX-Role-Restricted-1.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.03   Source  

NAME ^

  MooseX::Role::Restricted - (DEPRECATED) Restrict which sub are exported by a role

SYNOPSIS ^

  package MyApp::MyRole;

  use MooseX::Role::Restricted;

  sub method1 { ... }
  sub _private1 { ... }

  sub _method2 :Public { ... }
  sub private2 :Private { ... }

DEPRECATED ^

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.

DESCRIPTION ^

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

SEE ALSO ^

Moose::Role

AUTHOR ^

Graham Barr <gbarr@cpan.org>

COPYRIGHT & LICENSE ^

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.

syntax highlighting: