[prev] [thread] [next] [Date index for 2005/04/30]
This is a multi-part message in MIME format. ------_=_NextPart_001_01C54DCF.A754FD7C Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable cfaust-dougot wrote: >>> 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; > >> >>> 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...". > >> >>> Any suggestions? >That's funky :) But you can't do that. Since those constants are really >subroutines. What you are returning are strings, so you will need to = eval >those before using those. The best run the script that will adjust the >constants: http://people.apache.org/~geoff/fixme Thanks Stas, I was hoping to avoid any sort of preprocessing but if = that's what it takes so you guys can keep producing lighting in a = bottle, I'm not going to complain. =20 -Chris =20 ------_=_NextPart_001_01C54DCF.A754FD7C Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Diso-8859-1">=0A= <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">=0A= <HTML>=0A= <HEAD>=0A= =0A= <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version = 6.5.7226.0">=0A= <TITLE>Re: Code fix/suggestion after MP2 update</TITLE>=0A= </HEAD>=0A= <BODY>=0A= <DIV dir=3Dltr><FONT size=3D2>cfaust-dougot wrote:<BR>>>> =0A= Folks,<BR>>>> <BR>>>> I hope my brain is just not =0A= functioning properly yet as its Saturday, but I'm having a tough time = figuring =0A= out the best way to handle the needed changed of "Apache::*" to =0A= "Apache2::Const*" automatically so I don't have to edit anything with a = script =0A= going up on 2 different servers with 2 the 2 different MP2 =0A= installs.<BR>>>> <BR>>>> The code that was = effected for =0A= me was simple enough, all my handler's are =0A= just:<BR>>>> <BR>>>> <BR>>>> sub = handler =0A= {<BR>> >> $r =3D = shift;<BR>> >><BR>>>> =0A= my $request_type =3D = anything<BR>>>> <BR>>>> if =0A= ($request_type eq 'Apache::REDIRECT') {<BR>>>> =0A= $r->headers_out->set(Location =3D> =0A= $back_url);<BR>>>> #return =0A= Apache2::Const::REDIRECT;<BR>>>> # =0A= or<BR>>>> return =0A= Apache::REDIRECT;<BR>>>> } else = {<BR>>>> =0A= #return Apache::OK;<BR>>>> # = or<BR>>>> =0A= return Apache2::Const::OK;<BR>>>> =0A= }<BR>>>> <BR>>>> = }<BR>>>> <BR>>>> =0A= I thought it would be nice and easy to do it with a PerlSetVar in the = conf file, =0A= so I would have something like<BR>>>> <BR>>>> in =0A= conf:<BR>>>> PerlSetVar ApacheReturnRedirect =0A= Apache::REDIRECT<BR>>>> =0A= PerlSet....<BR>>>> <BR>>>> In =0A= handler<BR>>>> 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>>>> &= nbsp; } =0A= else {<BR>>>> return =0A= $r->dir_config->get('ApacheReturnOk');<BR>>>> =0A= }<BR>>>><BR>>>> But that didn't work, got an error of = Argument =0A= "Apache::REDIRECT" isn't numeric, I also can't do it within any sort of = "if" =0A= statement in the script itself as I will get the error of "Apache::* not = allowed =0A= while script subs...".<BR>> >><BR>>>> Any =0A= suggestions?<BR><BR>>That's funky :) But you can't do that. Since = those =0A= constants are really<BR>>subroutines. What you are returning are = strings, so =0A= you will need to eval<BR>>those before using those. The best run the = script =0A= that will adjust the<BR>>constants: <A =0A= href=3D"http://people.apache.org/~geoff/fixme">http://people.apache.org/~= geoff/fixme</A><BR></FONT></DIV>=0A= <DIV dir=3Dltr><FONT size=3D2>Thanks Stas, I was hoping to avoid any = sort of =0A= preprocessing but if that's what it takes so you guys can keep = producing =0A= lighting in a bottle, I'm not going to complain.</FONT></DIV>=0A= <DIV dir=3Dltr><FONT size=3D2></FONT> </DIV>=0A= <DIV dir=3Dltr><FONT size=3D2>-Chris</FONT></DIV>=0A= <DIV dir=3Dltr><FONT size=3D2> </DIV></FONT>=0A= =0A= </BODY>=0A= </HTML> ------_=_NextPart_001_01C54DCF.A754FD7C--
![]() |
Code fix/suggestion after MP2 update
|
![]() |
![]() |
Re: Code fix/suggestion after MP2 update
|
![]() |
![]() |
RE: Code fix/suggestion after MP2 update
|
![]() |
![]() |
![]() |
Re: Code fix/suggestion after MP2 update
|
Generated at 15:53 on 25 May 2005 by mariachi v0.52