Posted on 2008-07-24 13:32:46-07 by sh4r4d in response to 2666
Re: Can't locate loadable object for module Apache::Constants in @INC error
Hi Same issue I have face but now with RHEL5 in Apache-AuthenNIS, this the problem in /usr/lib/perl5/vendor_perl/5.8.8/Apache/AuthenNIS.pm wih the some mod_perl2 in RHEL5 here the use mod_perl need to change to use mode_perl2 and respective Apache:: to Apache2:: This the patch.
--- AuthenNIS.pm 2008-07-25 00:46:36.000000000 +0530 +++ AuthenNIS.pm.Modified 2008-07-25 00:46:39.000000000 +0530 @@ -9,22 +9,23 @@ $Apache::AuthenNIS::VERSION = '0.13'; ############################################ # here is where we start the new code.... ############################################ -use mod_perl ; +use mod_perl2 ; # setting the constants to help identify which version of mod_perl # is installed -use constant MP2 => ($mod_perl::VERSION >= 1.99); +use constant MP2 => ($mod_perl2::VERSION >= 1.99); # test for the version of mod_perl, and use the appropriate libraries BEGIN { if (MP2) { - require Apache::Const; - require Apache::Access; - require Apache::Connection; - require Apache::Log; - require Apache::RequestRec; - require Apache::RequestUtil; - Apache::Const->import(-compile => 'HTTP_UNAUTHORIZED','OK', 'HTTP_INTERNAL_SERVER_ +ERROR', 'DECLINED'); + require Apache2::Const; + require Apache2::Access; + require Apache2::Connection; + require Apache2::Log; + require Apache2::RequestRec; + require Apache2::RequestUtil; + Apache2::Const->import( -compile => ('HTTP_UNAUTHORIZED','OK', 'HTTP_INTERNAL_SERV +ER_ERROR', 'DECLINED')); +# use Apache2::Const -compile => qw( HTTP_INTERNAL_SERVER_ERROR DECLINED HTTP_UNAUT +HORIZED OK ); } else { require Apache::Constants; Apache::Constants->import('HTTP_UNAUTHORIZED','OK', 'HTTP_INTERNAL_SERVER_ERROR', +'DECLINED'); @@ -32,6 +33,7 @@ BEGIN { } ##################### end modperl code ###################### + sub handler { my $r = shift; my($res, $sent_pwd) = $r->get_basic_auth_pw; @@ -45,13 +47,13 @@ sub handler { unless($domain) { $r->note_basic_auth_failure; MP2 ? $r->log_error("Apache::AuthenNIS - cannot obtain NIS domain", $r->uri) : $r->log_re +ason("Apache::AuthenNIS - cannot obtain NIS domain", $r->uri); - return MP2 ? Apache::HTTP_INTERNAL_SERVER_ERROR : Apache::Constants::HTTP_INTERNAL_SERVER_ERROR; + return MP2 ? Apache2::Const::HTTP_INTERNAL_SERVER_ERROR : Apache::Constants::HTTP_INTERNAL_SERVER +_ERROR; } if ($name eq "") { $r->note_basic_auth_failure; MP2 ? $r->log_error("Apache::AuthenNIS - no username given", $r->uri) : $r->log_reason("Ap +ache::AuthenNIS - no username given", $r->uri); - return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED; + return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED; } my ($status, $entry) = Net::NIS::yp_match($domain, "passwd.byname", $name); @@ -59,35 +61,35 @@ sub handler { if($status) { if (lc($allowaltauth) eq "yes" && $status == 5) { - return MP2 ? Apache::DECLINED : Apache::Constants::DECLINED; + return MP2 ? Apache2::Const::DECLINED : Apache::Constants::DECLINED; } else { my $error_msg = Net::NIS::yperr_string($status); $r->note_basic_auth_failure; MP2 ? $r->log_error("Apache::AuthenNIS - user $name: yp_match: status $status, $error_ +msg", $r->uri) : $r->log_reason("Apache::AuthenNIS - user $name: yp_match: status $status, $error_ +msg", $r->uri); - return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED; + return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED; } } my ($user, $hash, $uid, $gid, $gecos, $dir, $shell) = split(/:/, $entry); if(crypt($sent_pwd, $hash) eq $hash) { - return MP2 ? Apache::OK : Apache::Constants::OK; + return MP2 ? Apache2::Const::OK : Apache::Constants::OK; } else { if (lc($allowaltauth) eq "yes") { - return MP2 ? Apache::DECLINED : Apache::Constants::DECLINED; + return MP2 ? Apache2::Const::DECLINED : Apache::Constants::DECLINED; } else { $r->note_basic_auth_failure; MP2 ? $r->log_error("Apache::AuthenNIS - user $name: bad password", $r->uri) : $r->log_r +eason("Apache::AuthenNIS - user $name: bad password", $r->uri); - return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED; + return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED; } } - return MP2 ? Apache::OK : Apache::Constants::OK; + return MP2 ? Apache2::Const::OK : Apache::Constants::OK; } 1;
. Regards and Thanks Sharad
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.