Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^5: fetch all data

by poj (Abbot)
on Mar 17, 2019 at 18:23 UTC ( [id://1231372]=note: print w/replies, xml ) Need Help??


in reply to Re^4: fetch all data
in thread fetch all data

Don't print anything before the header. Create the list and then print it in the page

my $records = $sth->fetchall_arrayref; my $list = join ' ',map{$_->[0]}@$records; print "Content-type: text/html\n\n"; print <<END_HTML; <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <p>Age list </p> <p>$list</p> </body> </html> END_HTML
poj

Replies are listed 'Best First'.
Re^6: fetch all data
by bigup401 (Pilgrim) on Mar 17, 2019 at 20:03 UTC

    thanks poj. you saved me from using Template Toolkit module

      Why would sticking to print statements be advantageous over using a templating system? Bare use CGI scripts become hard enough to maintain without mixing all the components of the model, view, and controller together. I think that your comment that our helping to resolve a database issue saved you from having to use Template::Toolkit is indication that your separation of concerns is broken, and could probably be helped by thinking in terms of a separate model, view, and controller architecture.


      Dave

      Your issue wasn't related to templates in any way.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1231372]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-19 07:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found