[Catalyst] Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema

Tomas Doran bobtfish at bobtfish.net
Fri Aug 28 17:26:37 GMT 2009


On 28 Aug 2009, at 18:11, pablo marin-garcia wrote:

> Hello Tom,
>
> thanks for your answer
>
> On Thu, Aug 27, 2009 at 11:45 PM, Tomas Doran<bobtfish at bobtfish.net>  
> wrote:
>>
>> On 27 Aug 2009, at 21:52, pablo marin-garcia wrote:
>
>> Nono, that isn't a Moose feature at all..
>>
>> It's the use of Moose::Autobox which allows you to lexically call  
>> stuff...
>> So for example:
>>
>> use Moose::Autobox;
>> my @list = 2->flatten;
>> my @other_list = [ 2 ]->flatten;
>> is_deeply \@list, \@other_list;
>>
>>>> I'm just not seeing how Moose::Autobox can pass it's tests for  
>>>> you (which
>>>> involve ->flatten working), but fail when run for real..
>
> The reason the the autobox pass is because they are not testing
> 'flatten' or 'to' or other 'methods' like that.

Erm, yes - autobox doesn't provide any methods itself.

As I said, I don't see how Moose::Autobox (which does provide those  
methods) works... This is why I was confused about why the  
Moose::Autobox tests didn't fail...

> This drive me to the conclusion that somewere the  xxx::flaten mehtod
> is not defined, so I am missing the module where this is defined,
> probably in Moose::Autobox:: or autobox:: submodules
>
> So someone knows where the Moose::Autobox::ARRAY::flatten lives (or
> whatever is the namespace given to it)?

It's in Moose::Autobox - I recommend grep as a method of finding  
things..

> Am I in the right path of reasoning or I have missed something? I am
> new to all this 'perl6' magic like autobox implementation and 'modern
> perl'.

Please stop making up random names for shit cause you don't understand  
it. You did it with 'Moose Arrays', and you're now doing it with  
'perl6 magic'.

Otherwise I will be referring to everything as vroomfondle from now on.

> BUT the thing that drive me crazy is that the 'make test' done
> manually was ok with the SCALAR etc subs, but when I run calling only
> the test it FAILED!!!!!
>
> =======
> pg4 at deskpro17122[~/.cpan/build/autobox-2.55-RKhwNV]226
> $ perl t/flatten.t

Right, so it fails with your installed version...

Try perl -Ilib t/flatten.t and it'll work I guess

As you're theoretically running the latest versions, it'd be  
interesting to compare the autobox files on disk to those in the dist  
(as this test failing with your installed autobox version indicates  
that it's autobox which is the source of the problem).

> Yes, I know this, but as you can see there was an '=' sign
>
> Module  = Moose::Autobox::Indexed (RJBS/Moose-Autobox-0.09.tar.gz)
>
> telling that I am up to date, so it was not necesary to go go to the :
>

Aha, yes - my bad.

Cheers
t0m




More information about the Catalyst mailing list