Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
What do you think? Is this the best way to approach it? Is it even a good way? Thanks.package @SQLData ... sub css { if needed, define css here, else link to it. this will be mostly used for html emails, given that linking to it will be a pain if it goes outside the company } sub foo { my $bar = shift(@_); my @output; my $sql = ("sql code here") my @array $sql->execute; while (@array = $sql->fetchrow_array) { if ($bar=='csv') { push(@output,"$foo[0],$foo[1]"} } else { push(@output,"<tr><td>$foo[0]</td><td>$foo[1]</td></tr>"); } } $sql->finish(); return @output; }
2005-08-17 Retitled by Arunbear, as per Monastery guidelines
Original title: 'How does this look?'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Exporting data from database as HTML or CSV
by dragonchild (Archbishop) on Aug 16, 2005 at 19:18 UTC | |
|
Re: Exporting data from database as HTML or CSV
by jZed (Prior) on Aug 16, 2005 at 18:40 UTC |