How to manipulate rows in returned resultset

"Kapoor, Nishikant" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.html-template
Message-ID <B4448B75FF74124ABB5793D8BFBEEA3901C13DF9@exccpgo04.corp.xcelenergy.com>
For populating loops, I get the resultset from db, and assign it directly to the loop_var. This works wonderfully for most cases, except where there is a need to process each row before assigning it to the template. One particular case is where I am retrieving a resultset after a search query, and I need to highlight the text that was searched for.

Is there a way I can continue to use the 'single' assignment, and still achieve this objective?

Thanks,
Nishi

Here is some code snippet to explain it more:

my $data = &getDataFromDB;
$template->param(myLoopVar => $data);  #preferred way

#BUT, if I need to bold the 'search text', I need to iterate through the loop
my @loopData=();
foreach my $rec (@{$data}) {
  my %loopRow;
  $rec->{title} =~ s/(\b$searchText\b)/<b>$1<\/b>/ig;
  $loopRow{title} = $rec->{title};
  push @loopData, \%loopRow;
}
$template->param(myLoopVar => \@loopData);



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.