Re: [Dbix-class] Problem getting data from resultset

2012-07-06 Thread Kenneth S Mclane
Patrick Meidl wrote on 07/06/2012 04:00:09 PM: > > if you posted your code it would be easier to help debug it... > > patrick > > -- > Patrick Meidl patr...@pantheon.at > Vienna, Austria .. http://gplus.to/pmeidl I will post my current code o

Re: [Dbix-class] Problem getting data from resultset

2012-07-06 Thread Patrick Meidl
On Fri, Jul 06 2012, Kenneth S Mclane wrote: > I added this and I get a never ending stream of : > Use of uninitialized value $data[0] in join or string at > /opt/catalyst/dbms/script/../lib/dbms/Controller/AccountView.pm line 59. > > Which is just a debug statement, but it never ends. I comme

Re: [Dbix-class] Problem getting data from resultset

2012-07-06 Thread Kenneth S Mclane
Patrick Meidl wrote on 07/06/2012 03:29:41 PM: > 'exists' tests the existence of hash keys, array elements and subroutine > names, not object methods (see 'perldoc perlfunc'). as I mentioned > before, you should use can() for this. so something like this should put > you on the right track: > >

Re: [Dbix-class] Problem getting data from resultset

2012-07-06 Thread Patrick Meidl
On Fri, Jul 06 2012, Kenneth S Mclane wrote: > > Subject: > > > > Re: [Dbix-class] Problem getting data from resultset > > > > > > foreach my $method (split(/\./, $field)) { > > last unless ($val); > > $val = $val->$method; > > } > > > > should solve this. > > > That just causes an i

Re: [Dbix-class] Join Myself?

2012-07-06 Thread Fernan Aguero
On Fri, Jul 6, 2012 at 3:33 PM, Steve Wells wrote: > > I'm trying to convert this SQL statement to DBIC and I'm failing miserably. Not a lot of magic required, see 'Joining to the same table twice' in http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Manual/Joining.pod For joining a table t

[Dbix-class] Join Myself?

2012-07-06 Thread Steve Wells
I'm trying to convert this SQL statement to DBIC and I'm failing miserably. given: mytable id foreignkey date_added SQL -- select T1.id from mytable T1 left join mytable T2 on (T1.foreignkey = T2.foreignkey and T1.date_added < T2.date_added) where T2.date

Re: [Dbix-class] Problem getting data from resultset

2012-07-06 Thread Kenneth S Mclane
> Subject: > > Re: [Dbix-class] Problem getting data from resultset > > > foreach my $method (split(/\./, $field)) { > last unless ($val); > $val = $val->$method; > } > > should solve this. > > patrick > > -- That just causes an infinite loop somewhere. I have been trying an if

Re: [Dbix-class] Problem getting data from resultset

2012-07-06 Thread Patrick Meidl
On Fri, Jul 06 2012, Kenneth S Mclane wrote: > > perl doesn't eval $data->$field in the way you expect it to. you would > > have to do something like > > > > my $val = $data; > > foreach my $method (split(/\./, $field)) { > > $val = $val->$method; > > } > > $ws->write($row, $col, $val); > >

Re: [Dbix-class] Problem getting data from resultset

2012-07-06 Thread Kenneth S Mclane
Devin Austin wrote on 07/06/2012 09:18:59 AM: > From: > > Devin Austin > > To: > > "DBIx::Class user and developer list" > > Date: > > 07/06/2012 09:24 AM > > Subject: > > Re: [Dbix-class] Problem getting data from resultset > > I'm late to the party here but you're using Catalyst, what

Re: [Dbix-class] Problem getting data from resultset

2012-07-06 Thread Kenneth S Mclane
> perl doesn't eval $data->$field in the way you expect it to. you would > have to do something like > > my $val = $data; > foreach my $method (split(/\./, $field)) { > $val = $val->$method; > } > $ws->write($row, $col, $val); > > to make your code more robust, you should add some sanity chec

Re: [Dbix-class] Problem getting data from resultset

2012-07-06 Thread Patrick Meidl
On Fri, Jul 06 2012, Kenneth S Mclane wrote: > Ok, I now have this code: > > my @fields = qw/ department.department_code account_code account_name > account_policy compliance.percent_compliant metrics.num_servers > metrics.num_subsystems progress.percent_complete /; > foreach my $field

Re: [Dbix-class] Problem getting data from resultset

2012-07-06 Thread Devin Austin
I'm late to the party here but you're using Catalyst, what's wrong with the spreadsheet view? (forgive me for not linking it) Sent from my iPhone On Jul 6, 2012, at 8:09 AM, Kenneth S Mclane wrote: > > > your code will only work for fields in the main table of your resultset, > > but will br

Re: [Dbix-class] Problem getting data from resultset

2012-07-06 Thread Kenneth S Mclane
> your code will only work for fields in the main table of your resultset, > but will break for relations. for example, > $data->department.department_code is not a valid accessor. you will have > to parse your field definition and convert it into > $data->department->department_code in order to re