[Catalyst] Modifying a value returned with DBIC

Octavian Rasnita orasnita at gmail.com
Fri Jan 5 05:19:24 GMT 2007


Hi,

I want to get some messages from a database using DBIx::Class, then to pass 
them to TT, but I also want to make some preformatting before sending to TT.
(I don't know if TT can do what I want).

I did:

@messages = $c->model("Db::Forum")->search({
id_room => $id_room,
},
{
join => "id_user",
prefetch => "id_user",
rows => $c->user->nr_messages || 10,
order_by => 'date desc, time desc',
});

$c->stash->{messages} = \@messages;

But I want to replace \n in the body of the messages with <br />, and who 
knows, maybe other such format changes.

Which is the recommended way of doing this?
Should I loop @messages in the program, get each value, modify it and store 
it into another array then send it to TT, or there is another more elegant 
method?

Thank you.

Octavian




More information about the Catalyst mailing list