Priorities when using Any::Moose, and what Mouse people should do
A recent test script of mine broke with the following message: You can only consume roles, MooseX::Role::Loggable is not a Moose role at /usr/lib/perl5/Moose/Util.pm line 137. What happened?
This test script uses Juno and an internal module that we have at work here. Both of them use Any::Moose. They also use my MooseX::Role::Loggable which uses Any::Moose as well, in order to allow you to use it in Moose and Mouse.
The problem started when I changed my internal module to use Moose instead of Any::Moose (I needed native traits, native traits are awesome). This broke everything. Why, I thought, isn't this supposed to be interchangeable? Oh, it is, it is. The problem was the order of loading in the test script. Because it loaded Juno first, Any::Moose loaded Mouse. When I loaded the internal module (which now uses Moose) first, it loaded Moose and Any::Moose loaded that too, which allows MooseX::Role::Loggable to use Moose instead of Mouse and be consumed correctly.
So, the lesson is this: everyone using Mouse should use Any::Moose. (btw, it seems like that was the purpose in the first place, so I'm not the only one saying it :)
Also, if you're gonna have something that uses hardcoded Moose, load that before loading any Any::Moose code.