Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Yet Another Stupid CGI Question

by alien_life_form (Pilgrim)
on Oct 19, 2001 at 12:57 UTC ( #119908=note: print w/replies, xml ) Need Help??


in reply to Yet Another Stupid CGI Question

Greetings.

Not understanding while you want to interpolate the entire sub, I would offer more ways to do it.
(1)

# Trivial double loop - build, then print my $aref=[]; #reference to anonymous array. foreach $thing (@thingies) { push @{$aref},foo($thing); } print_table($aref); #... sub print_table { my $aryref=shift foreach my $thing (@{$aryref}) { #etc. } }

(2)
#bypass cgi's html facilities print '<table>'; foreach $thing (@thingies){ #foo returns an array of cell contents. print '<tr><td>',join('</td><td>', foo($thing)),'</td><tr>'; } print '</table>';
CGI's html convenience functions are - IMHO - just that, convenience (as opposed to the powerful parameter parsing, handling, etc. where CGI unreplaceably shines).
Sometimes rolling your own html can be just the thing.

Cheers,
alf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://119908]
help
Chatterbox?
[usemodperl]: just because of banking apps on free wifi, and porn, i guess...
usemodperl thinks every1 should serve HTTP on port 80 incase we don't care about encryption, right? wtf

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-06-24 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?