Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Printing with CGI.pm

by Kanji (Parson)
on Jul 20, 2002 at 20:02 UTC ( [id://183662]=note: print w/replies, xml ) Need Help??


in reply to Printing with CGI.pm

But normally the content type is at the top of the page. Does any one know how to do that?

Place your print header before anything else, and make sure it isn't in a loop unless you have some way of surpressing multiple calls...

print header; while ( <FILE> ) { # ... }
while ( <FILE> ) { # ... print header unless $already_printed_header++; # ... }

However, in more recent versions of CGI, the functionality of the latter is actually built in for you, but needs to be enabled by supplying the -unique_headers argument to your use CGI...

use CGI qw/ -unique_headers /; while ( <FILE> ) { # ... print header; # ... }

    --k.


Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-25 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found