Data::Modelで$row->get_columnsを覚えた

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
my @json;
for my $msg (@{$messages}) {
    push @json,
      {
        id  => $msg->id,
        msg => $msg->msg,
        ts  => $msg->ts,
      };
}
$self->render(json => [@json]);
1
2
3
4
5
my @json;
for my $msg (@{$messages}) {
    push @json, $msg->get_columns;
}
$self->render(json => [@json]);
1
2
my @json = map { $_->get_columns } @{$messages};
$self->render(json => [@json]);
1
$self->render(json => [map { $_->get_columns } @{$messages}]);

Comments

comments powered by Disqus