Re: modperl2 Apache::HTTP_FORBIDDEN and Apache::HTTP_INTERNAL_SERVER_ERRORimplemented?
Stas Bekman wrote: Shannon Eric Peevey wrote: [...] *handler = MP2 ? \&handler2 : \&handler1; I am leaving the MP2 code in both of the subroutines, as I don't know if there is a prettier way to do this... (I will remove it, if there is not) Although this hasn't been tested extensively, it should be working fine now. thanks for the help! speeves cws PS It did complain about "Prototype mismatch: sub Apache::AuthenNTLM::handler vs ($$) at /usr/local/lib/perl/5.6.1/Apache/AuthenNTLM.pm" until I added the code into both subroutines. I've added a new section to the porting tutorial that shows examples of how to handle this situation: http://perl.apache.org/docs/2.0/user/porting/porting.html#Method_Handlers I changed the code for Apache-AuthenNTLM-2.04 to reflect your example, and it works great! Thanks for the pointer :) speeves cws
Re: modperl2 Apache::HTTP_FORBIDDEN and Apache::HTTP_INTERNAL_SERVER_ERRORimplemented?
Shannon Eric Peevey wrote: [...] *handler = MP2 ? \&handler2 : \&handler1; I am leaving the MP2 code in both of the subroutines, as I don't know if there is a prettier way to do this... (I will remove it, if there is not) Although this hasn't been tested extensively, it should be working fine now. thanks for the help! speeves cws PS It did complain about "Prototype mismatch: sub Apache::AuthenNTLM::handler vs ($$) at /usr/local/lib/perl/5.6.1/Apache/AuthenNTLM.pm" until I added the code into both subroutines. I've added a new section to the porting tutorial that shows examples of how to handle this situation: http://perl.apache.org/docs/2.0/user/porting/porting.html#Method_Handlers __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: modperl2 Apache::HTTP_FORBIDDEN and Apache::HTTP_INTERNAL_SERVER_ERRORimplemented?
Though I seem to be chasing it down to a possible problem with the method handler: sub handler ($$) But even with a change to: sub handler : method This is an interesting one. How to make the two coexist in the same code base. Ideally you want to do this: sub handler1 ($$) {} sub handler2 : method {} *handler = MP2 ? \&handler2 : \&handler1; But probably it'll complain about different prototypes. Or it might just work. Give it a try. Hi! Looks like your example will work, though, it is kind of messy, (probably because I don't completely follow the example). I basically added the handler code into the subroutines as defined: sub handler1 ($$) { my ($class, $r) = @_ ; my $type ; my $nonce = '' ; my $self ; ... } sub handler2 : method { my ($class, $r) = @_ ; my $type ; my $nonce = '' ; ... } *handler = MP2 ? \&handler2 : \&handler1; I am leaving the MP2 code in both of the subroutines, as I don't know if there is a prettier way to do this... (I will remove it, if there is not) Although this hasn't been tested extensively, it should be working fine now. thanks for the help! speeves cws PS It did complain about "Prototype mismatch: sub Apache::AuthenNTLM::handler vs ($$) at /usr/local/lib/perl/5.6.1/Apache/AuthenNTLM.pm" until I added the code into both subroutines.
Re: modperl2 Apache::HTTP_FORBIDDEN and Apache::HTTP_INTERNAL_SERVER_ERRORimplemented?
Shannon Eric Peevey wrote: Stas Bekman wrote: speeves wrote: Hi! Just wondering if Apache::HTTP_FORBIDDEN and Apache::HTTP_INTERNAL_SERVER_ERROR have been implemented? I have been trying to port Apache::AuthenNTLM, and keep getting: [Tue Jul 15 16:46:08 2003] [error] failed to resolve handler `Apache::AuthenNTLM' [Tue Jul 15 16:46:08 2003] [error] [client 192.168.1.2] Bareword "Apache::HTTP_FORBIDDEN" not allowed while "strict subs" in u se at /usr/local/lib/perl/5.6.1/Apache/AuthenNTLM.pm line 593. Bareword "Apache::HTTP_INTERNAL_SERVER_ERROR" not allowed while "strict subs" in use at /usr/local/lib/perl/5.6.1/Apache/Authe nNTLM.pm line 597. Bareword "Apache::HTTP_INTERNAL_SERVER_ERROR" not allowed while "strict subs" in use at /usr/local/lib/perl/5.6.1/Apache/Authe nNTLM.pm line 632. BEGIN not safe after errors--compilation aborted at /usr/local/lib/perl/5.6.1/Apache/AuthenNTLM.pm line 671. Compilation failed in require at (eval 10) line 3. in the error_log. I have other constants that are imported from Apache::Const, so do not think that it is a problem with scope... Here is the code: line 593 -- return $self->{ntlmauthoritative} ? (defined($nonce) ? (MP2 ? Apache::HTTP_FORBIDDEN : Apache::Constants::HTTP_ FORBIDDEN) : (MP2 ? Apache::HTTP_INTERNAL_SERVER_ERROR : Apache::Constants::HTTP_INTERNAL_SERVER_ERROR)) : (MP2 ? Apache::DE CLINED : Apache::Constants::DECLINED) ; and line 632 --- # return MP2 ? Apache::HTTP_INTERNAL_SERVER_ERROR : Apache::Constants::HTTP_INTERNAL_SERVER_ERROR ; If you need more, let me know. Have you imported them? use Apache::Const compile ->qw(Apache::HTTP_FORBIDDEN); All the available Apache:: constants are listed here: http://perl.apache.org/docs/2.0/api/Apache/Const.html Yeah, unfortunately... :( Why unfortunately? Though I seem to be chasing it down to a possible problem with the method handler: sub handler ($$) But even with a change to: sub handler : method This is an interesting one. How to make the two coexist in the same code base. Ideally you want to do this: sub handler1 ($$) {} sub handler2 : method {} *handler = MP2 ? \&handler2 : \&handler1; But probably it'll complain about different prototypes. Or it might just work. Give it a try. I'm still not able to access the imported CONSTANTS This is definitely the most complex port that I've done, so is taking me a little while to find all of the buggies... Will keep you posted :) probably because a mistake in my example above, drop the compile part. __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: modperl2 Apache::HTTP_FORBIDDEN and Apache::HTTP_INTERNAL_SERVER_ERRORimplemented?
Stas Bekman wrote: speeves wrote: Hi! Just wondering if Apache::HTTP_FORBIDDEN and Apache::HTTP_INTERNAL_SERVER_ERROR have been implemented? I have been trying to port Apache::AuthenNTLM, and keep getting: [Tue Jul 15 16:46:08 2003] [error] failed to resolve handler `Apache::AuthenNTLM' [Tue Jul 15 16:46:08 2003] [error] [client 192.168.1.2] Bareword "Apache::HTTP_FORBIDDEN" not allowed while "strict subs" in u se at /usr/local/lib/perl/5.6.1/Apache/AuthenNTLM.pm line 593. Bareword "Apache::HTTP_INTERNAL_SERVER_ERROR" not allowed while "strict subs" in use at /usr/local/lib/perl/5.6.1/Apache/Authe nNTLM.pm line 597. Bareword "Apache::HTTP_INTERNAL_SERVER_ERROR" not allowed while "strict subs" in use at /usr/local/lib/perl/5.6.1/Apache/Authe nNTLM.pm line 632. BEGIN not safe after errors--compilation aborted at /usr/local/lib/perl/5.6.1/Apache/AuthenNTLM.pm line 671. Compilation failed in require at (eval 10) line 3. in the error_log. I have other constants that are imported from Apache::Const, so do not think that it is a problem with scope... Here is the code: line 593 -- return $self->{ntlmauthoritative} ? (defined($nonce) ? (MP2 ? Apache::HTTP_FORBIDDEN : Apache::Constants::HTTP_ FORBIDDEN) : (MP2 ? Apache::HTTP_INTERNAL_SERVER_ERROR : Apache::Constants::HTTP_INTERNAL_SERVER_ERROR)) : (MP2 ? Apache::DE CLINED : Apache::Constants::DECLINED) ; and line 632 --- # return MP2 ? Apache::HTTP_INTERNAL_SERVER_ERROR : Apache::Constants::HTTP_INTERNAL_SERVER_ERROR ; If you need more, let me know. Have you imported them? use Apache::Const compile ->qw(Apache::HTTP_FORBIDDEN); All the available Apache:: constants are listed here: http://perl.apache.org/docs/2.0/api/Apache/Const.html Yeah, unfortunately... :( Though I seem to be chasing it down to a possible problem with the method handler: sub handler ($$) But even with a change to: sub handler : method I'm still not able to access the imported CONSTANTS This is definitely the most complex port that I've done, so is taking me a little while to find all of the buggies... Will keep you posted :) speeves cws
Re: modperl2 Apache::HTTP_FORBIDDEN and Apache::HTTP_INTERNAL_SERVER_ERRORimplemented?
speeves wrote: Hi! Just wondering if Apache::HTTP_FORBIDDEN and Apache::HTTP_INTERNAL_SERVER_ERROR have been implemented? I have been trying to port Apache::AuthenNTLM, and keep getting: [Tue Jul 15 16:46:08 2003] [error] failed to resolve handler `Apache::AuthenNTLM' [Tue Jul 15 16:46:08 2003] [error] [client 192.168.1.2] Bareword "Apache::HTTP_FORBIDDEN" not allowed while "strict subs" in u se at /usr/local/lib/perl/5.6.1/Apache/AuthenNTLM.pm line 593. Bareword "Apache::HTTP_INTERNAL_SERVER_ERROR" not allowed while "strict subs" in use at /usr/local/lib/perl/5.6.1/Apache/Authe nNTLM.pm line 597. Bareword "Apache::HTTP_INTERNAL_SERVER_ERROR" not allowed while "strict subs" in use at /usr/local/lib/perl/5.6.1/Apache/Authe nNTLM.pm line 632. BEGIN not safe after errors--compilation aborted at /usr/local/lib/perl/5.6.1/Apache/AuthenNTLM.pm line 671. Compilation failed in require at (eval 10) line 3. in the error_log. I have other constants that are imported from Apache::Const, so do not think that it is a problem with scope... Here is the code: line 593 -- return $self->{ntlmauthoritative} ? (defined($nonce) ? (MP2 ? Apache::HTTP_FORBIDDEN : Apache::Constants::HTTP_ FORBIDDEN) : (MP2 ? Apache::HTTP_INTERNAL_SERVER_ERROR : Apache::Constants::HTTP_INTERNAL_SERVER_ERROR)) : (MP2 ? Apache::DE CLINED : Apache::Constants::DECLINED) ; and line 632 --- # return MP2 ? Apache::HTTP_INTERNAL_SERVER_ERROR : Apache::Constants::HTTP_INTERNAL_SERVER_ERROR ; If you need more, let me know. Have you imported them? use Apache::Const compile ->qw(Apache::HTTP_FORBIDDEN); All the available Apache:: constants are listed here: http://perl.apache.org/docs/2.0/api/Apache/Const.html __ Stas BekmanJAm_pH --> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com