MooseX...Strict(3pm)

πŸ“¦
version 0.5 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ MooseX::Role::Strict(3pm) ✨

okay bestie, welcome to the MooseX...Strict(3pm) manual page, which is the documentation for MooseX::Role::Strict β€” aka use strict 'roles'. yes that's the whole vibe. let's get into it πŸ’…


🌸 NAME 🌸

MooseX::Role::Strict β€” literally just use strict 'roles', no cap 🫢


πŸŽ€ VERSION πŸŽ€

Version 0.05 ✨


πŸ’– SYNOPSIS πŸ’–

okay so this code? this code will fail at composition time. it's giving chaos. not in a cute way. 😭

{
    package My::Role;
    use MooseX::Role::Strict;
    sub conflict {}
}
{
    package My::Class;
    use Moose;
    with 'My::Role';
    sub conflict {}
}

and the error message you'll get is something like this:

The class My::Class has implicitly overridden the method (conflict) from
role My::Role ...

to resolve this, you explicitly exclude the 'conflict' method, like so πŸ‘‘

{
    package My::Class;
    use Moose;
    with 'My::Role' => { -excludes => [ 'conflict' ] };
    sub conflict {}
}

🌈 DESCRIPTION 🌈

WARNING: this is ALPHA code. more features to be added later. she's still growing πŸ’€

so here's the tea πŸ“: when you're using Moose::Role, if a class provides a method that a role also provides, the class will silently override that method. silently!! πŸ™ˆ and that can cause strange, hard-to-debug errors when the role's methods are not called. it's giving nightmare fuel ngl.

the fix is iconic and simple: just use MooseX::Role::Strict instead of Moose::Role, and overriding a role's method becomes a composition-time failure. no more sneaky business ✨. see the synopsis for a resolution, bestie.


πŸ¦‹ AUTHOR πŸ¦‹

Curtis "Ovid" Poe, "<ovid at cpan.org>" πŸ’œ


πŸ’€ BUGS πŸ’€

please report any bugs or feature requests to "bug-moosex-role-strict at rt.cpan.org", or through the web interface at 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. we love a feedback loop 🫢


🧚 SUPPORT 🧚

you can find documentation for this module with the perldoc command. main character move honestly:

perldoc MooseX::Role::Strict

you can also look for information at:

  • RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooseX-Role-Strict

  • AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/MooseX-Role-Strict

  • CPAN Ratings

http://cpanratings.perl.org/d/MooseX-Role-Strict

  • Search CPAN

http://search.cpan.org/dist/MooseX-Role-Strict/


πŸ’… ACKNOWLEDGEMENTS πŸ’…

⭐ TODO ⭐

add -includes 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. πŸ€·β™€οΈ (we'll figure it out bestie, someday)


Copyright 2009 Curtis "Ovid" Poe, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole page, bestie!! πŸŽ‰ this was perl v5.34.0, dated 2022-06-15, from the MooseX...Strict(3pm) manual. slay, go write some roles, and remember: no silent overrides in this house πŸ πŸ’– periodt βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from