No, don't do that!
Use $row->get_columns which returns a hash of the column data!
Accessing internal methods is bad, accessing internal hash keys is
doubleplusungood. If you find yourself doing that, go read some
documentation. If you haven't figured it out without doing that,
submit a patch for a proper method!
Here's the pod:
http://search.cpan.org/~ribasushi/DBIx-Class-0.08012/lib/DBIx/Class/Row.pm#get_columns
Also, you can use the HashRefInflator which works -fantastic- for
JSON views:
The code is very simple:
my $rs = $c->model('DB::Books');
$rs->resultclass('DBIx::Class::HashRefInflator');
$c->stash->{books} = [ $rs->all ];
You can read about that here:
http://search.cpan.org/~ash/DBIx-Class-0.08010/lib/DBIx/Class/ResultClass/HashRefInflator.pm
excellent, thanks guys, with minor modifications both those approaches
work:
$c->stash->{books} = [map { $_->get_columns } $c-
>model('DB::Books')->all];
OR:
my $rs = $c->model('DB::Books');
$rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
$c->stash->{books} = [ $rs->all ];
thanks again for your help
adam
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/