Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

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

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


harpactocrates at googlemail

Aug 25, 2009, 4:58 PM

Post #1 of 15 (2912 views)
Permalink
Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema

Hello,

Problem:
Can't call method "flatten" on unblessed reference at
/nfs/local_perl/perllib/Catalyst/Helper/Model/DBIC/Schema.pm line 165.

Preamble:
I was following the catalyst tutorial in a Debian etch, and when tried
 in tutorial_03 Create Static DBIx::Class Schema Files I had an error
with method "flatten"

$ script/myapp_create.pl model DB DBIC::Schema MyApp::Schema
create=static dbi:SQLite:myapp.db
 exists "/nfs/team108/pg4/webserver/catalyst/mytut/MyApp/script/../lib/MyApp/Model"
 exists "/nfs/team108/pg4/webserver/catalyst/mytut/MyApp/script/../t"
Can't call method "flatten" on unblessed reference at
/nfs/users/nfs_p/pg4/local_perl/perllib/Catalyst/Helper/Model/DBIC/Schema.pm
line 165.

I installed Catalyst in a macbook and this works OK. So seems that I
have a broken Moose module somewhere but I don't know how to find it.

Exploring:
The offending line:

"my @args   = $self->args->flatten if $self->args;"

if I unflatten the args with @{$self->args} the script works. It seems
that Moose is giving args a constrain isa=>ArrayRef but somewhere the
call to flatten (Moose::Autobox) is not properly handle.

I have no experience with Moose, and being the code metaprogramed is a
bit difficult follow the process with the debugger.

I would like to find out where I have the bad installed/missed module
(I assume that is part of Moose or Moose-catalyst). Could someone
point me in any interesting direction or how to keep in the search? I
have spent a day learning how Moose works but I run off ideas to fix
the issue.

Regards

PS: debugging oddity: in my macbook the scripts works ok but under the
debugger if the offending line

my @args   = $self->args->flatten if $self->args;

is run n by n it goes ok but if I evaluate with "x
$self->args->flatten" I have the same error than in my linux
installation about calling flatten in unblessed ref.

--
  - Pablo Marin-Garcia



--
- Pablo Marin-Garcia

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


bobtfish at bobtfish

Aug 25, 2009, 5:22 PM

Post #2 of 15 (2828 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

On 26 Aug 2009, at 00:58, pablo marin-garcia wrote:

> Hello,
>
> Problem:
> Can't call method "flatten" on unblessed reference at
> /nfs/local_perl/perllib/Catalyst/Helper/Model/DBIC/Schema.pm line 165.

Your Moose::Autobox, or autobox modules are busted. At a guess, the
latter, but it could be either.

How are you installing stuff in etch, as I have an install that works
just fine on etch with autobox?

Cheers
t0m


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


clive.projects at gmail

Aug 26, 2009, 2:20 AM

Post #3 of 15 (2814 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

Hiya,

I'm also experiencing the flatten message when trying to create a
model in catalyst. i'm running on windows with active state 822. the
guys on the #catalyst irc channel suggested likewise that it was
autobox or Moose::autobox. I've tried compiling autobox seperately
but it doesn't want to compile i get all kinds of errors when running
make, makefile etc.

so it appears that autobox causes problems. any ideas on how to fix it?

regards,
clive


On Wed, Aug 26, 2009 at 1:22 AM, Tomas Doran<bobtfish [at] bobtfish> wrote:
>
> On 26 Aug 2009, at 00:58, pablo marin-garcia wrote:
>
>> Hello,
>>
>> Problem:
>> Can't call method "flatten" on unblessed reference at
>> /nfs/local_perl/perllib/Catalyst/Helper/Model/DBIC/Schema.pm line 165.
>
> Your Moose::Autobox, or autobox modules are busted. At a guess, the latter,
> but it could be either.
>
> How are you installing stuff in etch, as I have an install that works just
> fine on etch with autobox?
>
> Cheers
> t0m
>
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


wdhawes at gmail

Aug 26, 2009, 2:30 AM

Post #4 of 15 (2821 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

2009/8/26 clive glew <clive.projects [at] gmail>:
> so it appears that autobox causes problems.  any ideas on how to fix it?

Unrelated to Catalyst (but perhaps relevant to this problem), I've
also seen issues with autobox on ActivePerl 5.8.8 build 822 - namely
that it doesn't work at all, not even the minimal examples in the
synopis, even though autobox and autobox::Core were sourced from the
AS ppm repository.

No problems on ActivePerl 5.10, perhaps someone at AS botched the
creation of the 5.8 package?

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


harpactocrates at googlemail

Aug 26, 2009, 3:06 AM

Post #5 of 15 (2828 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

> Your Moose::Autobox, or autobox modules are busted. At a guess, the latter,
> but it could be either.
>
> How are you installing stuff in etch, as I have an install that works just
> fine on etch with autobox?

I am using perl 5.8 and installed as non root with cpan (with the o
confs set to my local dirs).

I have both method installed and if I do 'force install autobox' all
the tests go ok and the same for moose::autobox

This is why I am stuk. I don't know how to test if it is a problem
with a dependences not tested in the test suits or something between
catalyst and moose in my installation. Any suggestions?





--
- Pablo Marin-Garcia

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


frioux at gmail

Aug 26, 2009, 10:16 AM

Post #6 of 15 (2801 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

On Wed, Aug 26, 2009 at 4:30 AM, Will Hawes <wdhawes [at] gmail> wrote:

> 2009/8/26 clive glew <clive.projects [at] gmail>:
> > so it appears that autobox causes problems. any ideas on how to fix it?
>
> Unrelated to Catalyst (but perhaps relevant to this problem), I've
> also seen issues with autobox on ActivePerl 5.8.8 build 822 - namely
> that it doesn't work at all, not even the minimal examples in the
> synopis, even though autobox and autobox::Core were sourced from the
> AS ppm repository.
>
> No problems on ActivePerl 5.10, perhaps someone at AS botched the
> creation of the 5.8 package?
>


Sorry, I hadn't seen this already. I reported the but re ActivePerl Package
here: http://bugs.activestate.com/show_bug.cgi?id=84155

The issue is probably the same for OP. Just rebuild autobox and you should
be good. AP users follow directions in the link.
--
fREW Schmidt
http://blog.afoolishmanifesto.com


bobtfish at bobtfish

Aug 26, 2009, 3:04 PM

Post #7 of 15 (2804 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

On 26 Aug 2009, at 22:46, pablo marin-garcia wrote:
> urllist
> 0 [ftp://ftp.mirrorservice.org/sites/ftp.funet.fi/pub/languages/perl/CPAN/
>
> But I can see it on searchCPAN
>
> I will try to install it from my mirror tomorrow

Tried reloading your index? And I'd pick a faster (to update)
mirror... ;)

Cheers
t0m


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


harpactocrates at googlemail

Aug 26, 2009, 3:25 PM

Post #8 of 15 (2804 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

On Wed, Aug 26, 2009 at 11:04 PM, Tomas Doran<bobtfish [at] bobtfish> wrote:
>

> Tried reloading your index? And I'd pick a faster (to update) mirror... ;)
>

yes,
And I have tried to install it manuall but still I have the flatten
problem. I have a broken module somewhere but I can not find it,

trying to install the dependency

CatalystX-Component-Traits-0.09

t/04-no_merge.t .......... Couldn't instantiate component
"MyApp::Controller::MyController", "Can't call method "flatten" on
unblessed reference at
/nfs/users/nfs_p/pg4/local_perl/perllib/MooseX/Traits/Pluggable.pm
line 107."# Looks like your test exited with 2 before it could output
anything.


Seems that any Moosy thing will fail because my autobox problem. But
autobox is OK in my system (all test passed) so the problem seems to
between Moose arrays and the flatten call as a OOmethod.

Cheers

--
- Pablo Marin-Garcia

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


bobtfish at bobtfish

Aug 26, 2009, 5:19 PM

Post #9 of 15 (2801 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

On 26 Aug 2009, at 23:25, pablo marin-garcia wrote:
> Seems that any Moosy thing will fail because my autobox problem. But
> autobox is OK in my system (all test passed) so the problem seems to
> between Moose arrays and the flatten call as a OOmethod.

Erm, no.

NOT any Moosy thing. Just things using Moose::Autobox. When you said
perl 5.8, could you be a little more specific please?

Like which version of perl 5.8, what your perl -V says, which versions
of Moose, Moose::Autobox and autobox you have would be helpful details..

FYI, there is no such thing as a 'Moose array', can you explain what
you mean here? Also ->flatten as a method call is what Moose::Autobox
gives you (a set of methods you can call on native data types)..

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..

Cheers
t0m

P.S. http://pause.perl.org/incoming/MooseX-Traits-
Pluggable-0.08.tar.gz - Now without autobox, please install this and
try again?

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


harpactocrates at googlemail

Aug 27, 2009, 1:52 PM

Post #10 of 15 (2759 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

Hello Tomas

On Thu, Aug 27, 2009 at 1:19 AM, Tomas Doran<bobtfish [at] bobtfish> wrote:
>
> On 26 Aug 2009, at 23:25, pablo marin-garcia wrote:
>>
>> Seems that any Moosy thing will fail because my autobox problem. But
>> autobox is OK in my system (all test passed) so the problem seems to
>> between Moose arrays and the flatten call as a OOmethod.
>
> Erm, no.
>
> NOT any Moosy thing. Just things using Moose::Autobox.

Thanks!!! with the new MooseX it works!

Now follows the rest of my email that I wrote before reading your PS.
I leave here for mailarchive-indexing just in case

> When you said perl
> 5.8, could you be a little more specific please?
>

This is perl, v5.8.8 built for i686-linux-thread-multi

> Like which version of perl 5.8, what your perl -V says, which versions of
> Moose, Moose::Autobox and autobox you have would be helpful details..

cpan[1]> m /Autobox/
CPAN: Storable loaded ok (v2.15)
Going to read /nfs/users/nfs_p/pg4/.cpan/Metadata
Database was generated on Wed, 26 Aug 2009 00:27:03 GMT
Module = Moose::Autobox (RJBS/Moose-Autobox-0.09.tar.gz)
Module = Moose::Autobox::Array (RJBS/Moose-Autobox-0.09.tar.gz)
Module = Moose::Autobox::Code (RJBS/Moose-Autobox-0.09.tar.gz)
Module = Moose::Autobox::Defined (RJBS/Moose-Autobox-0.09.tar.gz)
Module = Moose::Autobox::Hash (RJBS/Moose-Autobox-0.09.tar.gz)
Module = Moose::Autobox::Indexed (RJBS/Moose-Autobox-0.09.tar.gz)
Module = Moose::Autobox::Item (RJBS/Moose-Autobox-0.09.tar.gz)
Module = Moose::Autobox::List (RJBS/Moose-Autobox-0.09.tar.gz)
Module = Moose::Autobox::Number (RJBS/Moose-Autobox-0.09.tar.gz)
Module = Moose::Autobox::Ref (RJBS/Moose-Autobox-0.09.tar.gz)
Module = Moose::Autobox::Scalar (RJBS/Moose-Autobox-0.09.tar.gz)
Module = Moose::Autobox::String (RJBS/Moose-Autobox-0.09.tar.gz)
Module = Moose::Autobox::Undef (RJBS/Moose-Autobox-0.09.tar.gz)
Module = Moose::Autobox::Value (RJBS/Moose-Autobox-0.09.tar.gz)
Module Perl6ish::Autobox (GUGOD/Perl6ish-0.02.tar.gz)
Module Ruby::autobox (GFUJI/Ruby-0.07.tar.gz)
Module Rubyish::Autobox (GUGOD/Rubyish-0.32.tar.gz)
Module Shell::Autobox (CHOCOLATE/Shell-Autobox-0.03.tar.gz)
Module = autobox (CHOCOLATE/autobox-2.55.tar.gz)
Module autobox::Closure::Attributes
(SARTAK/autobox-Closure-Attributes-0.04.tar.gz)
Module autobox::Core (SWALTERS/autobox-Core-0.6.tar.gz)
Module autobox::DateTime::Duration
(MIYAGAWA/autobox-DateTime-Duration-0.02.tar.gz)
Module autobox::Encode (TOKUHIROM/autobox-Encode-0.03.tar.gz)
Module autobox::List::Util (COWENS/autobox-List-Util-20090629.tar.gz)
Module autobox::Numeric::Bytes (HIROSE/autobox-Numeric-Bytes-0.02.tar.gz)
Module autobox::Numeric::Time (HIROSE/autobox-Numeric-Time-0.02.tar.gz)
Module autobox::String::Inflector
(KAMIPO/autobox-String-Inflector-0.01.tar.gz)
Module autobox::array::dump (N/A)
Module autobox::dump (COWENS/autobox-dump-20090426.1746.tar.gz)
Module autobox::hash::dump (N/A)
Module autobox::scalar::dump (N/A)


>
> FYI, there is no such thing as a 'Moose array', can you explain what you
> mean here? Also ->flatten as a method call is what Moose::Autobox gives you
> (a set of methods you can call on native data types)..


When I was saying Moose array I was meaning the ArrayRef constraint
isa => ArrayRef
I have no experience with Moose, but I was assuming that or Moose
bless the array to be able to call methods, or there is an operator
overloading changing the meaning of the '->'. But anyway, I just
started with Moose and still don't know how it operates its magic.
>
> 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..

This is the thing that puzzled me. Probably I have installed an unused
dependency in the past with force and now is hitting me back.

I will leave this as it is at the moment. Probably this would be a
problem with my configuration [I don't have root access at work] and
this was an install in my home dir to play with catalyst in order to
have something before asking my system administrator to install the
whole thing in the development server. I managed to install it in my
macbook so I can use it with the new catalyst book :-).

I leave this here for the internet archive, I would come back when I
have a better understanding how to debug and follow Moose magic to
narrow down the place of the error. But I am sure that if I create a
new PER5LIB only for catalyst and install all from scratch it will
work. I would try to find the time some day ;-)

Thankgs

> Cheers
> t0m
>
> P.S. http://pause.perl.org/incoming/MooseX-Traits-Pluggable-0.08.tar.gz -
> Now without autobox, please install this and try again?
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>



--
- Pablo Marin-Garcia

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


bobtfish at bobtfish

Aug 27, 2009, 3:45 PM

Post #11 of 15 (2756 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

On 27 Aug 2009, at 21:52, pablo marin-garcia wrote:
>> When you said perl
>> 5.8, could you be a little more specific please?
>>
>
> This is perl, v5.8.8 built for i686-linux-thread-multi
>
>> Like which version of perl 5.8, what your perl -V says, which
>> versions of
>> Moose, Moose::Autobox and autobox you have would be helpful details..
>
> cpan[1]> m /Autobox/
>

Those are versions in your CPAN index, not the versions you have
installed.

perl -MMoose\ 999
perl -Mautobox\ 999
perl -MMoose::Autobox\ 999
perl -V

>>
>> FYI, there is no such thing as a 'Moose array', can you explain
>> what you
>> mean here? Also ->flatten as a method call is what Moose::Autobox
>> gives you
>> (a set of methods you can call on native data types)..
>
>
> When I was saying Moose array I was meaning the ArrayRef constraint
> isa => ArrayRef
> I have no experience with Moose, but I was assuming that or Moose
> bless the array to be able to call methods, or there is an operator
> overloading changing the meaning of the '->'. But anyway, I just
> started with Moose and still don't know how it operates its magic.

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..
>
> This is the thing that puzzled me. Probably I have installed an unused
> dependency in the past with force and now is hitting me back.

Or possibly something else in the stack has changed. If you get the
version numbers (as above), then try to re-install Moose::Autobox from
CPAN, what happens? (I.e. do the tests pass)

Cheers
t0m


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


harpactocrates at googlemail

Aug 28, 2009, 10:11 AM

Post #12 of 15 (2734 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

Hello Tom,

thanks for your answer

On Thu, Aug 27, 2009 at 11:45 PM, Tomas Doran<bobtfish [at] bobtfish> 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.

Looking deeply on autobox, I have seen that what it does it to call
SCALAR::the_function, ARRAY::the_function...etc depending of the ref()
or your 'object'

Then I unpacked the autobox tar and changed the tests and added a call
for flatten. It fails. But if I define the sub ARRAY::flatten {} it
works:

-----
$ cat t/flatten.t
use autobox;
use Test::More;
use Data::Dumper;

sub SCALAR::to_upper { uc $_[0] }
sub SCALAR::flatten {[$_[0]]}
sub SCALAR::to { $_[0]. '_to_'.$_[1]}
sub ARRAY::flatten{$_[0]}

my $range = eval{10->to(1)};
print Dumper $range;
is_deeply ($range, '10_to_1' , "autobox ->to test") or diag ($@);

my @list = eval{ 2->flatten} || 2;
my @other_list = eval{[ 2 ]->flatten}||[2];
is_deeply (\@list, \@other_list, "testing autobox flatten") or diag ("$@");


is('hello'->to_upper, 'HELLO', 'autobox is enabled');

-----

This test works with the subs defined:
> make test
> [...]
> t/flatten.t .... 1/? # Tests were run but no plan was declared and done_testing() was not seen.
>  t/flatten.t .... All 3 subtests passed
> [...]

But it fails *without* the subs ARRAY, SCALAR etc:

# Failed test 'autobox ->to test'
# at t/flatten.t line 16.
# got: undef
# expected: '10_to_1'
# Can't call method "to" without a package or object reference at
t/flatten.t line 14.

# Failed test 'testing autobox flatten'
# at t/flatten.t line 20.
# Structures begin differing at:
# $got->[0] = '2'
# $expected->[0] = ARRAY(0x81f88c0)
# Can't call method "flatten" on unblessed reference at t/flatten.t line 19.
Can't locate object method "to_upper" via package "hello" (perhaps you
forgot to load "hello"?) at t/flatten.t line 23.

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)?

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'.

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] deskpro1712[~/.cpan/build/autobox-2.55-RKhwNV]226
$ perl t/flatten.t
$VAR1 = undef;
not ok 1 - autobox ->to test
# Failed test 'autobox ->to test'
# at t/flatten.t line 16.
# got: undef
# expected: '10_to_1'
# Can't call method "to" without a package or object reference at
t/flatten.t line 14.
not ok 2 - testing autobox flatten
# Failed test 'testing autobox flatten'
# at t/flatten.t line 20.
# Structures begin differing at:
# $got->[0] = '2'
# $expected->[0] = ARRAY(0x81f8904)
# Can't call method "flatten" on unblessed reference at t/flatten.t line 19.
Can't locate object method "to_upper" via package "hello" (perhaps you
forgot to load "hello"?) at t/flatten.t line 23.
# Tests were run but no plan was declared and done_testing() was nots seen.

[~/.cpan/build/autobox-2.55-RKhwNV]227
$ make test
PERL_DL_NONLAZY=1 /software/perl-5.8.8/bin/perl
"-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib',
'blib/arch')" t/*.t
t/all.t ........ ok
t/autoref.t .... ok
t/coderef.t .... ok
t/default.t .... ok
t/export.t ..... ok
t/flatten.t .... 1/? # Tests were run but no plan was declared and
done_testing() was not seen.
t/flatten.t .... All 3 subtests passed
[..]
=======

I will think about it during the long weekend ;-)

Definitively I have some misconfigurations somewhere :-(

Regards

Pablo

PS:

About mi perl installation:

>> cpan[1]> m /Autobox/
>
> Those are versions in your CPAN index, not the versions you have installed.

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 :

$ perl -mautobox -e 'print $autobox::VERSION'
2.55
$ perl -mMoose::Autobox -e 'print $Moose::Autobox::VERSION'
0.09

I have installed autobox in
$ find . -name '*autobox*'
./man/man3/autobox.3pm
./perllib/i486-linux-gnu-thread-multi/auto/autobox
./perllib/i486-linux-gnu-thread-multi/auto/autobox/autobox.so
./perllib/i486-linux-gnu-thread-multi/auto/autobox/autobox.bs
./perllib/i486-linux-gnu-thread-multi/autobox
./perllib/i486-linux-gnu-thread-multi/autobox.pod
./perllib/i486-linux-gnu-thread-multi/autobox.pm

and my my perl -V
$ perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=linux, osvers=2.6.8lustre, archname=i686-linux-thread-multi
uname='linux bc-1-2-01 2.6.8lustre #1 smp mon oct 17 13:36:09 bst
2005 i686 gnulinux '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc-3.4', ccflags ='-D_REENTRANT -D_GNU_SOURCE
-DTHREADS_HAVE_PIDS -fno-strict-aliasing -pipe
-Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-fno-strict-aliasing -pipe -Wdeclaration-after-statement
-I/usr/local/include'
ccversion='', gccversion='3.4.4 20050314 (prerelease) (Debian
3.4.3-13sarge1)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc-3.4', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.3.2'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E
-Wl,-rpath,/software/perl-5.8.8/lib/5.8.8/i686-linux-thread-multi/CORE'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP THREADS_HAVE_PIDS USE_ITHREADS
USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
Built under linux
Compiled at Jan 8 2007 15:50:11
%ENV:

@INC:
/nfs/users/nfs_p/pg4/local_perl/perllib/i686-linux-thread-multi
/nfs/users/nfs_p/pg4/local_perl/perllib
/nfs/users/nfs_p/pg4/local_perl/lib/perl5/
/nfs/users/nfs_p/pg4/local_perl/perllib/i486-linux-gnu-thread-multi
/nfs/users/nfs_p/pg4/local_perl/perllib/i386-linux-thread-multi
/software/perl-5.8.8/lib/5.8.8/i686-linux-thread-multi
/software/perl-5.8.8/lib/5.8.8
/software/perl-5.8.8/lib/site_perl/5.8.8/i686-linux-thread-multi
/software/perl-5.8.8/lib/site_perl/5.8.8
/software/perl-5.8.8/lib/site_perl
.



--
- Pablo Marin-Garcia

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


bobtfish at bobtfish

Aug 28, 2009, 10:26 AM

Post #13 of 15 (2731 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

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>
> 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] deskpro1712[~/.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


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


harpactocrates at googlemail

Aug 28, 2009, 2:56 PM

Post #14 of 15 (2732 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

On Fri, Aug 28, 2009 at 6:26 PM, Tomas Doran<bobtfish [at] bobtfish> wrote:
>
> On 28 Aug 2009, at 18:11, pablo marin-garcia wrote:

>> 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.

You are rigth, sorry about that. I was mentioning perl6 because the
autobox::Core docs (but probably this does not apply here, sorry)

======
Some things expected in Perl 6, such as last, elems, and curry, have
been thrown in. For use in conjuction with Perl6::Contexts, flatten
explicitly flattens an array. Functions have been defined for numeric
operations.
======

>
> works... This is why I was confused about why the Moose::Autobox tests
> didn't fail...

Well this is the crazy thing:

/usr/bin/perl "-Iinc" "-MModule::Install::ExtraTests" "-e"
"Module::Install::ExtraTests::__harness('Test::Harness', 0, '',
'xt/release', '', 0, 'blib/lib', 'blib/arch')" t/*.t
t/000_load.t ............... ok
t/001_basic.t .............. ok
t/002_role_hierarchy.t ..... ok
t/003_p6_example.t ......... ok
t/004_list_compressions.t .. ok
t/005_string.t ............. ok
t/006_y_combinator.t ....... ok
t/007_base.t ............... ok
t/008_flatten.t ............ ok
All tests successful.
Files=9, Tests=156, 6 wallclock secs ( 0.13 usr 0.03 sys + 4.98
cusr 0.38 csys = 5.52 CPU)
Result: PASS
RJBS/Moose-Autobox-0.09.tar.gz
/usr/bin/make test -- OK

>> pg4 [at] deskpro1712[~/.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

No, it does not.

$ perl -llib t/flatten.t
$VAR1 = undef;

not ok 1 - autobox ->to test
# Failed test 'autobox ->to test'
# at t/flatten.t line 16.
# got: undef
# expected: '10_to_1'
# Can't call method "to" without a package or object reference at
t/flatten.t line 14.
not ok 2 - testing autobox flatten
# Failed test 'testing autobox flatten'
# at t/flatten.t line 20.
# Structures begin differing at:
# $got->[0] = '2'
# $expected->[0] = ARRAY(0x81f8888)
# Can't call method "flatten" on unblessed reference at t/flatten.t line 19.
Can't locate object method "to_upper" via package "hello" (perhaps you
forgot to load "hello"?) at t/flatten.t line 23.
# Tests were run but no plan was declared and done_testing() was not seen.

But as every cloud has a silver lining, I will take this chance to
update finally to perl 5.10

FINALLY IT WORKS!

I have updated my PERL5LIB to a new local_lib and the good parts is
that Moose already intalled in my system for perl 5.10 so I don't
even need to install it.

$ perl_5.10 flatten.t
$VAR1 = '10_to_1';
ok 1 - autobox ->to test
ok 2 - testing autobox flatten
ok 3 - autobox is enabled
# Tests were run but no plan was declared and done_testing() was not seen.

Definitively there was something wrong with my conf in old perl. But
it is not worthy to explore any longer this can of worms. I am not
able to use catalyst with my new perl ;-).

Now I am installing Catalyst again in the perl_5-10 and facing new problems

Should I install this module? [Y/n]:
gpg: Signature made Sun May 31 11:43:05 2009 BST using DSA key ID 96509C21
gpg: Can't check signature: public key not found
[ERROR] Signature check failed for module 'CGI::Simple::Cookie' -- Not
trusting this module, aborting install

But this would be another story and I would ask my sysadmin to fight
this battle.


Thanks a million for your help Tom.


--
- Pablo Marin-Garcia

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


harpactocrates at googlemail

Aug 28, 2009, 6:59 PM

Post #15 of 15 (2721 views)
Permalink
Re: Problem flattening arrays in Catalyst/Helper/Model/DBIC/Schema [In reply to]

Finally (for the records)

Found the problem: the autobox module installed in the system perl
works (without my perl5lib)! my non root installation of autobox was
not working when run from the shell (but it worked from make_test
during installation in the build dir??!!). Anyway the problem started
when CPAN force me to install autobox because a missing dependence
(CPAN didn't saw the modules installed in the root installation of
perl). After realizing that autobox was installed in the perl
libraries installed by root, I removed manually the autobox installed
in my local lib. And now it works using the one installed by root!!

>From here I have learned that for non root installations sometimes is
wise to use force install and check manually the depencies and skip
the ones with C code if they are installed by system (for example GD,
DBI, XML::LibXML , autobox etc ). But why I am not seen the modules
already installed by systems? It seems that it is because I have
update my cpan script and now I am using the one in my
local_installation.

AND the final lesson: Don't update CPAN when non root, becuase then it
would be installed in your local dir and it would not report the root
intalled modules!!! [or at least not for me]

== perl 5.8 cpan script updated locally ==

Module id = autobox
CPAN_USERID CHOCOLATE (chocolateboy <chocolate [at] cpan>)
CPAN_VERSION 2.55
CPAN_FILE C/CH/CHOCOLATE/autobox-2.55.tar.gz
INST_FILE (not installed)

== perl 5.8 cpan script intalled with perl ==
CPAN: Storable loaded ok (v2.18)
Going to read /nfs/users/nfs_p/pg4/.cpan/Metadata
Database was generated on Fri, 28 Aug 2009 00:27:11 GMT
Module id = autobox
CPAN_USERID CHOCOLATE (chocolateboy <chocolate [at] cpan>)
CPAN_VERSION 2.55
CPAN_FILE C/CH/CHOCOLATE/autobox-2.55.tar.gz
UPLOAD_DATE 2008-05-25
MANPAGE autobox - call methods on native types
INST_FILE
/software/perl-5.8.8/lib/5.8.8/i686-linux-thread-multi/autobox.pm
INST_VERSION 2.55

--
- Pablo Marin-Garcia

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.