Use strict 'roles'
Version 0.05
This code will fail at composition time:
{ package My::Role; use MooseX::Role::Strict; sub conflict {} } { package My::Class; use Moose; with 'My::Role'; sub conflict {} }
With an error message similar to the following:
The class My::Class has implicitly overridden the method (conflict) from role My::Role ...
To resolve this, explicitly exclude the 'conflict' method:
{ package My::Class; use Moose; with 'My::Role' => { -excludes => [ 'conflict' ] }; sub conflict {} }
\s-1WARNING\s0: this is \s-1ALPHA\s0 code. More features to be added later.
When using Moose::Role, a class which provides a method a role provides will silently override that method. This can cause strange, hard-to-debug errors when the role's methods are not called. Simple use \*(C`MooseX::Role::Strict\*(C' instead of \*(C`Moose::Role\*(C' and overriding a role's method becomes a composition-time failure. See the synopsis for a resolution.
Curtis \*(L"Ovid\*(R" Poe, \*(C`<ovid at cpan.org>\*(C'
Please report any bugs or feature requests to \*(C`bug-moosex-role-strict at rt.cpan.org\*(C', or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Role-Strict <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Role-Strict>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc MooseX::Role::Strict
You can also look for information at:
\s-1RT:\s0 \s-1CPAN\s0's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-Role-Strict <http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-Role-Strict>
AnnoCPAN: Annotated \s-1CPAN\s0 documentation http://annocpan.org/dist/MooseX-Role-Strict <http://annocpan.org/dist/MooseX-Role-Strict>
\s-1CPAN\s0 Ratings http://cpanratings.perl.org/d/MooseX-Role-Strict <http://cpanratings.perl.org/d/MooseX-Role-Strict>
Search \s-1CPAN\s0 http://search.cpan.org/dist/MooseX-Role-Strict/ <http://search.cpan.org/dist/MooseX-Role-Strict/>
Add \*(C`-includes\*(C' to make things easier:
with 'Some::Role' => { -includes => 'bar' };
That reverses the sense of '-excludes' in case you're more interested in the interface than the implementation. I'm unsure of the syntax for auto-converting a role to a pure interface.
Copyright 2009 Curtis \*(L"Ovid\*(R" Poe, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.