Ok. Once I wrap my stuff, how do I get the parameters from GET? How do I build a new URI from an existing one, changing only one or two params? I've read through some 500 pages in the past two days and I'm getting nowhere. I know tons about how to secure a mod_perl server, but I can't find out how to USE the bloody thing!
------
We are the carpenters and bricklayers of the Information Age.
The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6
... strings and arrays will suffice. As they are easily available as native data types in any sane language, ... - blokhead, speaking on evolutionary algorithms
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
| [reply] |
OK, I see your point.Without having tried it myself (I lack the time now), it seems you can replace CGI.pm by Apache::Request. The only change to your script is how you instantiate the request-object into a CGI-compatible object: use Apache::RequestRec;
sub handler {
my $r=shift;
my $req = Apache::RequestRec->new($r);
...
}
$req will now act as a CGI-object and all well-known CGI-methods for getting and setting the GET and POST parameters (as they are implemented in Apache::RequestRec) can be used.
CountZero "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
| [reply] [d/l] |
Ok. Once I wrap my stuff, how do I get the parameters from GET? How do I build a new URI from an existing one, changing only one or two params? I've read through some 500 pages in the past two days and I'm getting nowhere. I know tons about how to secure a mod_perl server, but I can't find out how to USE the bloody thing!
Walk away. Seriously, just walk away for a few hours/days.
This stench of despair is not good.
http://perl.apache.org/docs/2.0/user/coding/cooking.html
use CGI::Cookie ();
use Apache::RequestRec ();
use APR::Table ();
use Apache::Const -compile => qw(REDIRECT);
my $location = "http://example.com/final_destination/";
sub handler {
my $r = shift;
my $cookie = CGI::Cookie->new(-name => 'mod_perl',
-value => 'awesome');
$r->err_headers_out->add('Set-Cookie' => $cookie);
$r->headers_out->set(Location => $location);
$r->status(Apache::REDIRECT);
return Apache::REDIRECT;
}
1;
The first argument to your handler is a Apache::RequestRec object.
Now go read some documentation to see what you get with Apache::RequestRec.
| [reply] [d/l] |