[Dbix-class] Problem getting data from resultset

Kenneth S Mclane ksmclane at us.ibm.com
Fri Jul 6 15:54:05 GMT 2012


> 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 checking, like
> 
> if ($val->can($method)) { ... }
> 
> HTH
> 
>     patrick
> 
> -- 
> Patrick Meidl ........................ patrick at pantheon.at

I'm almost there, having some issues with null values. I keep getting an 
error about not being able to perform object method on an undefined etc. I 
can't find my way around it. I tried this and it sets it to 0 but still 
bombs out with the same error.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20120706/dfbf9650/attachment-0001.htm


More information about the DBIx-Class mailing list