[sf-perl] Mouse, again?
Joseph Brenner
doomvox at gmail.com
Mon Mar 5 16:23:42 PST 2012
yary <not.com at gmail.com> wrote:
> "Any::Moose" picks Mouse if it is available, then falls back to Moose.
Yes, you're right. I just played around with some code (using the
perl debugger's "m $object" feature as a probe), and if you have Moose
and Mouse both installed, this gets you a Mouse-based object:
use Any::Moose;
Though this gets you a Moose-based object:
use Moose;
use Any::Moose;
(And interestingly enough, vice-versa throws an error.)
So just *installing* Moose isn't enough to suddenly flip the behavior
of your Any::Moose code... on the other hand, someone else using your
code might see a change if some other code they're using brought in
Moose before you did your Any::Moose.
This still makes me a bit queasy... and the only thing Any::Moose
helps you with is it saves you from the work of manually doing a
s/Mouse/Moose/ when you want to upgrade...
On Mon, Mar 5, 2012 at 3:16 PM, yary <not.com at gmail.com> wrote:
> On Mon, Mar 5, 2012 at 6:09 PM, Joseph Brenner
> <doom at kzsu.stanford.edu> wrote: ...
>> (b) I write a bunch of code that uses Mouse.
>>
>> (c) later, Moose gets installed. Note: the person doing this might
>> not have thought about it very much, it might just be a dependency of
>> something else they're experimenting with.
>>
>> (d) the code that I've written develops some odd performance problems,
>> despite the fact that nothing has apparently changed with it.
>
>
> "Any::Moose" picks Mouse if it is available, then falls back to Moose.
> Unless the end user requests Moose. From the docs:
>
> "By default, Mouse will be provided to libraries, unless Moose is
> already loaded -or- explicitly requested by the end-user. The end-user
> can force the decision of which backend to use by setting the
> environment variable ANY_MOOSE to be Moose or Mouse.
>
> Note that the decision of which backend to use is made only once, so
> that if Any-Moose picks Mouse, then a third-party library loads Moose,
> anything else that uses Any-Moose will continue to pick Mouse.
>
> So, if you have to use Mouse, please be considerate to the Moose
> fanboys (like myself!) and use Any-Moose instead. :)"
>
> -y
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
More information about the SanFrancisco-pm
mailing list