[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] CGI.pm & MacPerl (easy one I'm certain)



>Ok folks,
>
>The following code:
>
>#!/usr/bin/perl -w
>
>use CGI qw(:standard);
>
>$query = new CGI;
>$query->header();
>$query->start_html();
>$query->h1( "Header text");
>
>print "<BR>test cgi stuff:";
>
>$query->start_form;
>
>$query->textfield(-name=>"State",
>		-default=>'gaseous',
>		-justification=>'RIGHT');
>
>$query->end_form;
>
>print $query->p("<BR>done with cgi test");
>$query->end_html();

This doesn't produce the results you want because the lines beginning
with $query-> don't print anything by themselves.  They return a string
that you have to print yourself.  (This makes sense, because you might
want to invoke CGI methods to generate HTML but store the HTML away
until later.  Anyway, you want:

#!/usr/bin/perl -w

use CGI qw(:standard);

print $query = new CGI;
print $query->header();
print $query->start_html();
print $query->h1( "Header text");

print "<BR>test cgi stuff:";

print $query->start_form;

print $query->textfield(-name=>"State",
		-default=>'gaseous',
		-justification=>'RIGHT');

print $query->end_form;

print $query->p("<BR>done with cgi test");
print $query->end_html();

--
Paul DuBois
paul@snake.net
Home Page: http://www.primate.wisc.edu/people/dubois
Software:  http://www.primate.wisc.edu/software



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch