programmerPerl has asked for the wisdom of the Perl Monks concerning the following question:
package HandleCGIData2; # file: HandleCGIData2.pm # use statements, including # our new Apache2::Request module use strict; use Apache2::Const ':common'; use Apache2::Request; sub handler { # shift the argument and pass it into # the new() method in the Apache2::Request # class my $r = Apache2::Request->new(shift); # we can now call param() with the Apache2::Request # object in a similar way to using CGI.pm my $name = $r->param('name') || 'John Doe'; my $age = $r->param('age') || '50'; # set the content type and send the header $r->content_type('text/html'); # $r->send_http_header(); # print the HTML, including our variables # $name and $age $r->print(<<EOHTML); <html> <head> <title>Using Apache2::RequestIO</title> </head> <body bgcolor="#ffffff"> <h1>Using Apache2::Request</h1> name = $name<br> age = $age </body> </html> EOHTML return OK; } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: I can't find error section of code
by Xilman (Hermit) on Jun 20, 2010 at 07:28 UTC | |
|
Re: I can't find error section of code
by rowdog (Curate) on Jun 20, 2010 at 16:41 UTC | |
|
Re: I can't find error section of code
by Khen1950fx (Canon) on Jun 20, 2010 at 12:09 UTC |