Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Yet Another Stupid CGI Question

by alien_life_form (Pilgrim)
on Oct 19, 2001 at 12:57 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://119908]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-23 18:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found