Code fix/suggestion after MP2 update
[prev]
[thread]
[next]
[Date index for 2005/04/30]
This is a multi-part message in MIME format.
------_=_NextPart_001_01C54D88.53E4ADEB
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Folks,
=20
I hope my brain is just not functioning properly yet as its Saturday, =
but I'm having a tough time figuring out the best way to handle the =
needed changed of "Apache::*" to "Apache2::Const*" automatically so I =
don't have to edit anything with a script going up on 2 different =
servers with 2 the 2 different MP2 installs.
=20
The code that was effected for me was simple enough, all my handler's =
are just:
=20
=20
sub handler {
$r =3D shift;
=20
my $request_type =3D anything
=20
if ($request_type eq 'Apache::REDIRECT') {
$r->headers_out->set(Location =3D> $back_url);
#return Apache2::Const::REDIRECT;
# or
return Apache::REDIRECT;
} else {
#return Apache::OK;
# or
return Apache2::Const::OK;
}
=20
}
=20
I thought it would be nice and easy to do it with a PerlSetVar in the =
conf file, so I would have something like
=20
in conf:
PerlSetVar ApacheReturnRedirect Apache::REDIRECT
PerlSet....
=20
In handler
if ($request_type eq 'Apache::REDIRECT') {
$r->headers_out->set(Location =3D> $back_url);
return $r->dir_config->get('ApacheReturnRedirect');
} else {
return $r->dir_config->get('ApacheReturnOk');
}
But that didn't work, got an error of Argument "Apache::REDIRECT" isn't =
numeric, I also can't do it within any sort of "if" statement in the =
script itself as I will get the error of "Apache::* not allowed while =
script subs...".
=20
Any suggestions?
=20
Thanks In Advance!
-Chris
=20
------_=_NextPart_001_01C54D88.53E4ADEB
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML =
DIR=3Dltr><HEAD><META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1"></HEAD><BODY><DIV><FONT face=3D'Arial' =
color=3D#000000 size=3D2>Folks,</FONT></DIV>=0A=
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>=0A=
<DIV><FONT face=3DArial size=3D2>I hope my brain is just not functioning =
properly =0A=
yet as its Saturday, but I'm having a tough time figuring out the best =
way to =0A=
handle the needed changed of "Apache::*" to "Apache2::Const*" =0A=
automatically so I don't have to edit anything with a script going up on =
2 =0A=
different servers with 2 the 2 different MP2 installs.</FONT></DIV>=0A=
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>=0A=
<DIV><FONT face=3DArial size=3D2>The code that was effected for me was =
simple =0A=
enough, all my handler's are just:</FONT></DIV>=0A=
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>=0A=
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>=0A=
<DIV>sub handler {<BR> $r =3D shift;</DIV>=0A=
<DIV> </DIV>=0A=
<DIV> my $request_type =3D anything</DIV>=0A=
<DIV> </DIV>=0A=
<DIV> if ($request_type eq 'Apache::REDIRECT') =0A=
{<BR> $r->headers_out->set(Location =3D> =0A=
$back_url);<BR> #return =
Apache2::Const::REDIRECT;</DIV>=0A=
<DIV> # or</DIV>=0A=
<DIV> return Apache::REDIRECT;<BR> } else =0A=
{<BR> #return Apache::OK;</DIV>=0A=
<DIV> # or</DIV>=0A=
<DIV> return Apache2::Const::OK;<BR> }</DIV>=0A=
<DIV> </DIV>=0A=
<DIV>}</DIV>=0A=
<DIV> </DIV>=0A=
<DIV>I thought it would be nice and easy to do it with a PerlSetVar in =
the conf =0A=
file, so I would have something like</DIV>=0A=
<DIV> </DIV>=0A=
<DIV>in conf:</DIV>=0A=
<DIV>PerlSetVar ApacheReturnRedirect Apache::REDIRECT</DIV>=0A=
<DIV>PerlSet....</DIV>=0A=
<DIV> </DIV>=0A=
<DIV>In handler</DIV>=0A=
<DIV> if ($request_type eq 'Apache::REDIRECT') =0A=
{<BR> $r->headers_out->set(Location =3D> =0A=
$back_url);<BR> return =0A=
$r->dir_config->get('ApacheReturnRedirect');<BR> } else =0A=
{<BR> return =0A=
$r->dir_config->get('ApacheReturnOk');<BR> }<BR></DIV>=0A=
<DIV>But that didn't work, got an error of Argument "Apache::REDIRECT" =
isn't =0A=
numeric, I also can't do it within any sort of "if" statement in the =
script =0A=
itself as I will get the error of "Apache::* not allowed while script =0A=
subs...".</DIV>=0A=
<DIV> </DIV>=0A=
<DIV>Any suggestions?</DIV>=0A=
<DIV> </DIV>=0A=
<DIV>Thanks In Advance!</DIV>=0A=
<DIV>-Chris</DIV>=0A=
<DIV> </DIV></BODY></HTML>
------_=_NextPart_001_01C54D88.53E4ADEB--
 |
Code fix/suggestion after MP2 update
cfaust-dougot 13:27 on 30 Apr 2005
|