You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Michael Peters <mp...@plusthree.com> on 2005/07/02 19:42:47 UTC
Re: module requires either Apache::Foo or Apache2::Foo
Geoffrey Young wrote:
> Michael Peters wrote:
>
>>Hello all,
>>
>>I have a module that can be run either under mod_perl 1 and 2. This
>>works great when running and testing using Apache-Test, but the bit I'm
>>having problems with is the install.
>>
>>For it to run properly it needs either Apache::Constants or
>>Apache2::Const. This is easy enough to figure out which one to pick at
>>run time (or compile time) but I can't figure out a good way to do this
>>at build time using either M::B or EU::MM so that the appropriate
>>prerequs are followed or at least complained about.
>
>
> see some of stas' modules on cpan - Apache::Peek comes to mind. IIRC
> they support both mp1 and mp2 and have some kind of dynamic build-time
> checking code in Makefile.PL
Thanks, I'll look into those.
> as a community we really ought to figure out the "right" way to do this
> and abstract it into something everyone can just cut-and-paste. or,
> better, include it as a package in both mp1 and mp2.
I think the "best" way might be to look to Apache::Test. Figuring out
which one to use at run time is easy and well documented but the
install/testing time is the tricky bit. I don't know if it's currently
available, but is there a way to query Apache::Test to find out which
version of mod_perl it will run against (since A::T figures this out
when it's installed right)?
--
Michael Peters
Developer
Plus Three, LP
Re: module requires either Apache::Foo or Apache2::Foo
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> I would argue that there is another case that is not as rare;
> dependencies. If a user tries to install my module via CPAN I would like
> it to be able to determine what other things need to be tracked down.
> And these dependencies may be different depending on the target mod_perl
> API version.
ah, nice idea :)
>>it also assumes that your mp1 user will actually have A-T installed. next
>>time we get together I'll need to rant a bit about how I can't stand modules
>>that refuse to _build_ because my @INC lack things they need only for their
>>_test_ environment.
>
>
> Oh, I completely agree. I like M::B's idea of 'build_requires' and it
> would be nice if it also had a 'test_requires' as well.
:)
>>dialogue saying something like
>>
>> this module can be installed for either mod_perl 1.0 or mod_perl 2.0
>> but you need to choose now: [1/2]
>>
>>and then leave you do do what you require.
>
>
> Ooohhh, that would be nice :)
yeah, I think that's really the best route, but the implementation really
depends on who has the free tuits atm to make something work.
in the meanwhile, a well documented
$ perl Makefile.PL MP2=1
in your personal INSTALL file might suffice. that's probably the route I
would go myself if I wanted to launch something right now.
>>mp1-only modules or modules that require no build-time interaction could
>>simply forget about querying all together.
>>
>>anyway, IIRC dorian has done some work on this front. probably not like
>>what I've just described, but he's done _something_ which is a start :)
>
>
> I don't have a lot of time right now to help, but if he has any ideas or
> something that partially works, I'd be willing to be a sounding/testing
> board.
yes, me too. I have Apache::Template ported to mp2 and if there were a
universal solution that's at least another module that would test/adopt it.
but my free tuits are rare these days wrt actually implementing it.
>>of course, there's nothing preventing you from using Apache::TestConfigData
>>etc now yourself. however, I don't think that is a viable or wise long-term
>>solution to the issue at hand.
>
>
> I think you convinced me of how bad an idea this is, so I turn my head
> and walk the other way :)
:)
--Geoff
Re: module requires either Apache::Foo or Apache2::Foo
Posted by Michael Peters <mp...@plusthree.com>.
Geoffrey Young wrote:
>>>as a community we really ought to figure out the "right" way to do this
>>>and abstract it into something everyone can just cut-and-paste. or,
>>>better, include it as a package in both mp1 and mp2.
>>
>>
>>I think the "best" way might be to look to Apache::Test. Figuring out
>>which one to use at run time is easy and well documented but the
>>install/testing time is the tricky bit. I don't know if it's currently
>>available, but is there a way to query Apache::Test to find out which
>>version of mod_perl it will run against (since A::T figures this out
>>when it's installed right)?
>
>
> well, kinda.
>
> what Apache-Test does is cache the data you entered when you ran 'make
> test'. for example, if you built Apache-Test as
>
> $ perl Makefile.PL -apxs /my/httpd-2.1-binary
>
> then A-T would never again ask you "what httpd do you want to use?" when,
> say, a CPAN module uses A-T for its tests and the user forgets to specify
> -apxs. of course, insert -httpd, APACHE_TEST_HTTPD, etc for -apxs.
>
> now, I've always maintained that this is a very bad idea whose
> implementation is still the source of the occasional frustrated user
> (besides myself), but I won't go into that here :) but I think it's even
> worse for what you're after.
>
> what we all want is a way for 'perl Makefile.PL' to know whether it's being
> built against mp1 or mp2 for the (rare) module that cares at build-time. a
> good example is for directive handlers, which are 100% runtime for mp2 but
> require build-time XS-fu for mp1. if a user has mp1 and mp2 on the same
> box, A-T will likely come from mp2 which would cause build-time inspection
> of A-T libraries to fail for mp1 installs if we chose the A-T route. worse,
> there will be no clear path for a confused user to follow when things don't
> go as they wish ("what does Apache-Test have to do with where Apache::Foo
> from CPAN installs?").
I would argue that there is another case that is not as rare;
dependencies. If a user tries to install my module via CPAN I would like
it to be able to determine what other things need to be tracked down.
And these dependencies may be different depending on the target mod_perl
API version.
> it also assumes that your mp1 user will actually have A-T installed. next
> time we get together I'll need to rant a bit about how I can't stand modules
> that refuse to _build_ because my @INC lack things they need only for their
> _test_ environment.
Oh, I completely agree. I like M::B's idea of 'build_requires' and it
would be nice if it also had a 'test_requires' as well.
> in short, using a test-environment variable to affect build or runtime
> environments breaks all sorts rules, if only those that I've made up and
> believe in myself :)
>
> that said, my personal preference would be a ModPerl::MM library that was
> distributed with both mp1 _and_ mp2. modules that are mp2-based could
> enforce mp2 via what they should already be doing:
>
> ModPerl::MM::WriteMakefile(NAME => 'My::MP2::Foo');
>
> modules that are both mp1 and mp2 but need to know at build-time should be
> able to do something as simple as
>
> my $version = ModPerl::MM::Query::version_query();
>
> before the call to WriteMakfile(), which would launch an interactive
> dialogue saying something like
>
> this module can be installed for either mod_perl 1.0 or mod_perl 2.0
> but you need to choose now: [1/2]
>
> and then leave you do do what you require.
Ooohhh, that would be nice :)
> mp1-only modules or modules that require no build-time interaction could
> simply forget about querying all together.
>
> anyway, IIRC dorian has done some work on this front. probably not like
> what I've just described, but he's done _something_ which is a start :)
I don't have a lot of time right now to help, but if he has any ideas or
something that partially works, I'd be willing to be a sounding/testing
board.
> of course, there's nothing preventing you from using Apache::TestConfigData
> etc now yourself. however, I don't think that is a viable or wise long-term
> solution to the issue at hand.
I think you convinced me of how bad an idea this is, so I turn my head
and walk the other way :)
--
Michael Peters
Developer
Plus Three, LP
Re: module requires either Apache::Foo or Apache2::Foo
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
>> as a community we really ought to figure out the "right" way to do this
>> and abstract it into something everyone can just cut-and-paste. or,
>> better, include it as a package in both mp1 and mp2.
>
>
> I think the "best" way might be to look to Apache::Test. Figuring out
> which one to use at run time is easy and well documented but the
> install/testing time is the tricky bit. I don't know if it's currently
> available, but is there a way to query Apache::Test to find out which
> version of mod_perl it will run against (since A::T figures this out
> when it's installed right)?
well, kinda.
what Apache-Test does is cache the data you entered when you ran 'make
test'. for example, if you built Apache-Test as
$ perl Makefile.PL -apxs /my/httpd-2.1-binary
then A-T would never again ask you "what httpd do you want to use?" when,
say, a CPAN module uses A-T for its tests and the user forgets to specify
-apxs. of course, insert -httpd, APACHE_TEST_HTTPD, etc for -apxs.
now, I've always maintained that this is a very bad idea whose
implementation is still the source of the occasional frustrated user
(besides myself), but I won't go into that here :) but I think it's even
worse for what you're after.
what we all want is a way for 'perl Makefile.PL' to know whether it's being
built against mp1 or mp2 for the (rare) module that cares at build-time. a
good example is for directive handlers, which are 100% runtime for mp2 but
require build-time XS-fu for mp1. if a user has mp1 and mp2 on the same
box, A-T will likely come from mp2 which would cause build-time inspection
of A-T libraries to fail for mp1 installs if we chose the A-T route. worse,
there will be no clear path for a confused user to follow when things don't
go as they wish ("what does Apache-Test have to do with where Apache::Foo
from CPAN installs?").
it also assumes that your mp1 user will actually have A-T installed. next
time we get together I'll need to rant a bit about how I can't stand modules
that refuse to _build_ because my @INC lack things they need only for their
_test_ environment.
in short, using a test-environment variable to affect build or runtime
environments breaks all sorts rules, if only those that I've made up and
believe in myself :)
that said, my personal preference would be a ModPerl::MM library that was
distributed with both mp1 _and_ mp2. modules that are mp2-based could
enforce mp2 via what they should already be doing:
ModPerl::MM::WriteMakefile(NAME => 'My::MP2::Foo');
modules that are both mp1 and mp2 but need to know at build-time should be
able to do something as simple as
my $version = ModPerl::MM::Query::version_query();
before the call to WriteMakfile(), which would launch an interactive
dialogue saying something like
this module can be installed for either mod_perl 1.0 or mod_perl 2.0
but you need to choose now: [1/2]
and then leave you do do what you require.
mp1-only modules or modules that require no build-time interaction could
simply forget about querying all together.
anyway, IIRC dorian has done some work on this front. probably not like
what I've just described, but he's done _something_ which is a start :)
of course, there's nothing preventing you from using Apache::TestConfigData
etc now yourself. however, I don't think that is a viable or wise long-term
solution to the issue at hand.
--Geoff
Re: module requires either Apache::Foo or Apache2::Foo
Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Michael Peters wrote:
> Geoffrey Young wrote:
>
>> Michael Peters wrote:
>> see some of stas' modules on cpan - Apache::Peek comes to mind. IIRC
>> they support both mp1 and mp2 and have some kind of dynamic build-time
>> checking code in Makefile.PL
>
>
> Thanks, I'll look into those.
Sadly I've not released an Apache::Peek for mp2 yet.
--
END
------------------------------------------------------------
What doesn't kill us can only make us stronger.
Nothing is impossible.
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Developer / Liquidity Services, Inc.
http://www.liquidityservicesinc.com