Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] CGI Problem: Premature end of script headers

Expand Messages
  • Charles K. Clarkson
    ... You don t need to specifically call the package main . ... This will only be called when check_something_important() returns 0 or undef. ... Frankly, I m
    Message 1 of 1 , Mar 6, 2002
    • 0 Attachment
      "James E Keenan" <jkeen@...> queried:

      : Any suggestions? Thanks in advance.
      :
      : ############# CODE BEGINS HERE #################
      : #!/usr/bin/perl -w
      : package main;

      You don't need to specifically call the package 'main'.

      : use strict;
      : use CGI;
      :
      : my $q = new CGI;
      :
      : unless(check_something_important()) {
      : error($q, "Something bad happened.");

      This will only be called when check_something_important()
      returns 0 or undef.

      : }

      Frankly, I'm surprised you're not getting a bareword error. You
      never call: 'use Error;'

      : sub check_something_important {
      : return 1;
      : }

      If this returned 0 or undef the error sub routine would be
      called. Otherwise you're not sending anything to the browser,
      which triggers the "premature" error.

      : #!/usr/bin/perl -w

      you don't need a she-bang line in a module. 'use warnings' works
      in the latest perl versions and is better - Read perllexwarn: "What's
      wrong with -w and $^W"

      : package Error; # suggested by Mouse, p 118

      [snip]

      When you're finished with the CGI book take a look at OOP &
      CGI::Application.


      HTH,
      Charles K. Clarkson
      --
      Clarkson Energy Homes, Inc.
      CJ Web Works - Domains for Real Estate Investors.

      E Pluribus Unum -- One from many.
    Your message has been successfully submitted and would be delivered to recipients shortly.