Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Bricolage: devel

mod_perl 1 vs mod_perl 2

 

 

Bricolage devel RSS feed   Index | Next | Previous | View Threaded


rolfm at denison

Dec 23, 2008, 12:21 PM

Post #1 of 3 (1421 views)
Permalink
mod_perl 1 vs mod_perl 2

In working on the Apache Auth stuff, I'm trying to get it to work
under mod_perl 1 and 2. Following David's advice, I added this code
to the module:

use Bric::Config qw(:mod_perl);
BEGIN { if (MOD_PERL) {
if (MOD_PERL_VERSION < 2) {
use Apache::Constants qw(:common :http REDIRECT);
use Apache::Log;
} else {
use Apache2::Const qw(:common :http REDIRECT);
use Apache2::Log;
}
}
}

But, I still get an error under apache 2:

[Tue Dec 23 19:33:32 2008] [error] [client xxx.xxx.xxx.xxx] failed to
resolve handler `Bric::App::ApacheAuthzHandler': Can't locate
Apache/Constants.pm in @INC (@INC contains: /usr/local/bricolage/lib

It shouldn't be looking for that stuff, provided I've done this right.
I'm sure it's something small that I'm missing.

Thanks,

Matt


david at kineticode

Dec 23, 2008, 3:26 PM

Post #2 of 3 (1330 views)
Permalink
Re: mod_perl 1 vs mod_perl 2 [In reply to]

On Dec 23, 2008, at 9:21 PM, rolfm [at] denison wrote:

> In working on the Apache Auth stuff, I'm trying to get it to work
> under mod_perl 1 and 2. Following David's advice, I added this code
> to the module:
>
> use Bric::Config qw(:mod_perl);
> BEGIN { if (MOD_PERL) {
> if (MOD_PERL_VERSION < 2) {
> use Apache::Constants qw(:common :http REDIRECT);
> use Apache::Log;
> } else {
> use Apache2::Const qw(:common :http REDIRECT);
> use Apache2::Log;
> }
> }
> }
>
> But, I still get an error under apache 2:
>
> [Tue Dec 23 19:33:32 2008] [error] [client xxx.xxx.xxx.xxx] failed
> to resolve handler `Bric::App::ApacheAuthzHandler': Can't locate
> Apache/Constants.pm in @INC (@INC contains: /usr/local/bricolage/lib
>
> It shouldn't be looking for that stuff, provided I've done this
> right. I'm sure it's something small that I'm missing.

You should just be using Bric::Util::ApacheConst.

Best,

David


alex at gossamer-threads

Dec 27, 2008, 2:30 PM

Post #3 of 3 (1301 views)
Permalink
Re: mod_perl 1 vs mod_perl 2 [In reply to]

Hi,

> use Bric::Config qw(:mod_perl);
> BEGIN { if (MOD_PERL) {
> if (MOD_PERL_VERSION < 2) {
> use Apache::Constants qw(:common :http REDIRECT);
> use Apache::Log;
> } else {
> use Apache2::Const qw(:common :http REDIRECT);
> use Apache2::Log;
> }
> }
> }

That's not right, use happens at compile time, so you can't do an
if/else clause like that. You'd need to turn it into require/imports
instead like:

BEGIN {
if (MOD_PERL_VERSION < 2) {
require Apache::Constants;
import Apache::Constants qw/:common :http REDIRECT/;
require Apache::Log;
}
else {
require Apache2::Const;
import Apache2::Const qw/:common :http REDIRECT/;
}
};

to see what I mean try:

alex [at] ale ~/projects/library $ echo "package Foo; print 'loading';" > Foo.pm
alex [at] ale ~/projects/library $ perl -le 'BEGIN { if (0) { use Foo; } print "Done"};'
loading
Done
alex [at] ale ~/projects/library $

Cheers,

Alex
--
Alex Krohn <alex [at] gossamer-threads>

Bricolage devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.