Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-02-24 22:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (311 votes). Check out past polls.

    Notices?