[html-formfu] moose?

Daisuke Maki daisuke at endeworks.jp
Tue Mar 24 17:56:52 GMT 2009


Carl,

so here I am about two weeks late in the discussion. forgive me.

I think you miss the point. Any::Moose is there to shut up people who 
quip about using Mouse. when YOU use it in production, you do

   ANY_MOOSE=Moose yourapp.pl

And everything using Any::Moose uses Moose. We shouldn't be using Mouse.

so why not use Moose directly?
In fact, I think Most people should be using Moose. But there exist 
enough people (around me anyway) that wants "lighter" modules. so they 
can do as they please with Mouse, but only via Any::Moose -- it's their 
option to shoot their own feet.

So to summarize:

   1) use Moose (ideally)
   2) but use Any::Moose (because people complain), and
   3) never use Mouse directly.

that's my take on CPAN modules and Any::Moose.


--d

Carl Franks wrote:
> 2009/3/5 Octavian Râsnita <orasnita at gmail.com>:
>> From: "Carl Franks" <fireartist at gmail.com>
>>> I think Any::Moose is a bad idea.
>>> Unless all your dependencies use it - which isn't going to happen as
>>> it's not mentioned in the Moose docs - it will cause problems.
>>> If a dependency starts to "use Moose", then everything using "use
>>> Any::Moose" will silently switch from using Mouse to Moose.
>> This is something good, not bad. If a dependency uses Moose, the program
>> will also use Moose, which would be a little slower, but if no dependency
>> uses Moose, then it will use Mouse, which would be faster.
> 
> Sorry, I've just realised that my original description wasn't very
> well written - the problem is that everything *won't* magically switch
> to using Moose.
> Take the following as an example:
> 
> package MyA;
> use Any::Moose;
> 1;
> 
> package MyB;
> use Moose;
> 1;
> 
> package MyC;
> use Any::Moose;
> 1;
> 
> package main;
> use Data::Dumper;
> use MyA;
> use MyB;
> use MyC;
> 
> sub using {
>     my ($class) = @_;
>     no warnings;
>     print Data::Dumper->Dump([ eval "\\\%{${class}::}->{has}" ], [$class]);
> }
> 
> using('MyA');
> using('MyB');
> using('MyC');
> 
> ### This prints the following...
> $MyA = \*Mouse::has;
> $MyB = \*MyB::has;
> $MyC = \*Mouse::has;
> ###
> 
> MyA uses Any::Moose which loads Mouse
> MyB uses Moose
> MyC uses Any::Moose which still uses Mouse
> 
> Take the instance that one of your dependencies starts using Moose:
> unless you get really lucky and it happens to load before anything
> using Any::Moose,
> then the only way to ensure Any::Moose correctly uses Moose rather
> than Mouse is to keep track of all your dependencies, and every time
> you update any cpan module, check whether 'Moose.pm' has sneaked into
> your %INC.
> And then add "use Moose" to your main program, to ensure it's loaded
> before any "use Any::Moose" statement.
> 
> Now, if you have a thorough application test suite which you run after
> any upgrade, it's arguable whether or not it's really a problem that
> parts of the code uses Moose, and other parts Mouse.
> 
> But I would argue that Mouse + Any::Moose only have a legitimate place
> in end-users' application code, and not cpan modules.
> 
> Cheers,
> Carl
> 
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
> 




More information about the HTML-FormFu mailing list