Well, I'm not all that familiar with the CGI.pm html generation
functions, but if they simply generate HTML elements, there should be no
reason you can't mix CGI.pm calls with your own html code. Something like:


---------------
#!/usr/bin/perl

use CGI;
$q = new CGI;

open(OUTPUTFILE, ">&STDOUT") || die "$!"; # just for testing

print OUTPUTFILE $q->header;
print OUTPUTFILE $q->start_html('Application');

print OUTPUTFILE $q->center(
        $q->h2("My Company Name"),
        $q->p($q->strong("Application")),
);

print OUTPUTFILE <<END_OF_FORM;
        <form action="handle_form.cgi" method="POST">

        ....

        </form>
END_OF_FORM


print OUTPUTFILE $q->end_html();

----------------

        This tested just fine for me.

        Also, your second example should work fine as well -- just use
CGI.pm for variable processing and do all the output yourself. That's how I
generally do it!

        Another little trick you can do with this "for here" print syntax
and html output is great for keeping your program code nice and indented
without affecting the way your html code is displayed:

sub Something {

        print <<"       END_OF_FORM"; # note that is a tab not spaces ...
                <html>
                <head>
                        <title>Something</title>
                </head>
                <body ....>
                        .....
                </body>
                </html>
        END_OF_FORM
        # ... which matches the tab there at the start of the preceeding line
}


        ---Larry


At 1:10 PM -0500 12/10/02, John Stokes wrote:
>Really?
>
>How could I mix something like:
>
>print OUTPUTFILE $q->start_html('Application');
>print OUTPUTFILE $q->center(
>$q->h2("My Company Name"),
>$q->p($q->strong("Application")),
>);
>
>print OUTPUTFILE $q->p("Applicant's Name: ",$q->b($q->param("Name"));
>
>With something like print >> End_of_form? Isn't that producing two HTML
>headers, which is illegal?
>
>...unless I just use CGI.pm for variable processing. Hmmm. Would this work?
>
>use CGI;
>my $q = new CGI();
>
>print OUTPUTFILE >> End_of_form
>
><B>My Company Name</B>
>Applicant's Name: $q->param("Name")
>
>End_of_form
>
>??
>
>If that's a legal syntax, then that solves my problem!
>
>Thanks all!
>
>-John


+------------------------------------------------------------------------+
| Larry Coffin, G.P.H.                                     Watertown, MA |
| http://www.PointInfinity.com/lcoffin/        [EMAIL PROTECTED] |
+------------------------------------------------------------------------+

Hofstadter's Law:
        It always takes longer than you expect, even when you take
Hofstadter's Law into account.


-



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to