in reply to Printing content-type in the proper context

I would put the html generating code as a separate function/module, then the caller can decide whether they want to print out the content-type or not.
  • Comment on Re: Printing content-type in the proper context

Replies are listed 'Best First'.
Re^2: Printing content-type in the proper context
by jacques (Priest) on Dec 24, 2004 at 04:33 UTC
    The function prints an entire HTML page. So I am inclined to put the header in the function. Plus, it's more simple for novice users to write:
    printHTML();
    Instead of using the CGI module and writing:
    print header, printHTML();
      HTML and HTTP headers are two different things, so it's a good idea to have them in separate functions. For lazy users, you can provide a wrapper third function which calls both:
      sub print_everything_with_extra_cheese { print header(); print printHTML(); }
      A reply falls below the community's threshold of quality. You may see it by logging in.