Apache::AuthCookieDBI's login.cgi (or .pl ) looks like this in 1.x:
#!/usr/bin/perl use strict; use HTML::Template; use Apache; + use constant TMPL_PATH => '/home/httpd/domain.com/html/app_templates'; use constant TMPL_FILE => 'login.tmpl'; my $r = Apache->request; $r->status(200); my $destination; my $authcookiereason; if ( $r->prev() ) { # we are called as a subrequest. $destination = $r->prev()->args() ? $r->prev()->uri() . '?' . $r->prev->args() : $r->prev()->uri(); $authcookiereason = $r->prev()->subprocess_env( 'AuthCookieRea +son' ); } else { $destination = $r->args( 'destination' ); $authcookiereason = $r->args( 'AuthCookieReason' ); } $r->log_error( "previous was: $destination" ); my $reason = $r->prev->subprocess_env("AuthCookieReason"); my $tmpl = HTML::Template->new( path => TMPL_PATH, filename => TMPL_FILE ); my $msg = ( $authcookiereason and $authcookiereason ne 'no_cookie' ? 1 + : 0 ); $tmpl->param( REASON => $msg ); $tmpl->param( uri => $destination ); my $form = $tmpl->output(); $r->no_cache(1); my $x = length($form); $r->content_type("text/html"); $r->header_out("Content-length","$x"); $r->header_out("Pragma", "no-cache"); $r->send_http_header; $r->print($form);
After I read the renaming documentation and applied the changes, the code should look something like this:
Yet, when the handler is fired off, the following error ends up in the error_log:#!/usr/bin/perl use strict; use HTML::Template; use Apache2::RequestUtil (); use constant TMPL_PATH => '/home/httpd/domain.com/templates'; use constant TMPL_FILE => 'login.tmpl'; my $r = Apache2::RequestUtil->request(); $r->status(200); .....
[Mon Aug 21 09:44:27 2006] [error] [client xx.xx.xx.xx] Can't locate o +bject method "request" via package "Apache2::RequestUtil" at /home/ht +tpd/domain.com/html/login.cgi line 12.
I thought a simple renaming of my $r = Apache->request(); to my $r = Apache2::RequestUtils->request() would suffice ... but that doesn't seem to be the case. Is there another renaming gotcha (i.e. some prereq) that I'm missing?
In reply to upgrading Apache::AuthCookieDBI application to mod_perl2 by geektron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |