You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by James G Smith <JG...@TAMU.Edu> on 2003/07/16 22:45:34 UTC

[RFC] Apache::Build

I've been moving several of my Perl modules from MakeMaker to
Module::Build.  I'm not seeing support for Module::Build in the
Apache::Test suite, so I thought I'd take a stab at subclassing
Module::Build to provide support for it.

I couldn't access the searchable archives for this list (get sent
back to http://www.apache.org/), but I did look through this month's
archive and didn't see anything obvious along this line.

Several questions before I jump even more head-long into this.

(1) Is Apache::Build a sensible, everyday name?  Should it perhaps
reside instead under Module::Build or Apache::Test?  I have no
problem with this module being its own distribution on CPAN.  I also
have no problem contributing it to an existing project.

(2) How DWIMmy should it be?  I like the following for my Build.PL
(as a goal):

 use Apache::Build;
 my $build = Apache::Build->new (
     module_name => 'Apache::Foo',
     license => 'perl',
     requires => {
         'perl'           => '5.6.1',
         'Some::Module'   => '1.23',
         'Other::Module'  => '>= 1.2, != 1.5, < 2.0',
     },
 );
 $build->create_build_script;

It should just work :)  This would also make any t/*.PL files into
t/* files.

(3) Support for multiple versions of Apache/mod_perl.

I'm also thinking about adding (at least) two functions to
Module::Build's API in the subclass (doc's based on those from
Module::Build):

   check_apache_status($version)
       This method returns a hash reference indicating whether a version
       dependency on Apache is satisfied.  The $version argument can take
       any of the forms described in the requires entry in the
       Module::Build manpage.  This allows very fine-grained version
       checking.

       The returned hash reference has the following structure:

        {
         ok => $whether_the_dependency_is_satisfied,
         have => $version_already_installed,
         need => $version_requested, # Same as incoming $version argument
         message => $informative_error_message,
        }

       If no version of Apache is currently installed, the have value will
       be the string < "<none" >>.  Otherwise the have value will simply
       be the version of Apache installed.

       This method may be called either as an object method (<
       $build->check_apache_status($version) >) or as a class method (<
       Apache::Build->check_apache_status($version) >).

   check_apache_version($version)
       Like check_apache_status(), but simply returns true or false
       depending on whether Apache statisfies the dependency $version.

       If the check succeeds, the return value is the actual version of
       Apache installed on the system.  This allows you to do the
       following:

        my $apache2 = $m->check_apache_version('2');
        if ($apache2) {
            print "Building for Apache 2.x.\n";
        }
        else {
            die "You must have Apache 2.x installed for this module.\n";
        }

       If the check fails, we return false and set $@ to an informative
       error message.

       If $version is any nontrue value (notably zero) and any version of
       Apache is installed, we return true.

       In general you might prefer to use check_apache_status if you need
       detailed information, or this method if you just need a yes/no
       answer.

I might add a few more as I get into it, but those come to mind right
now.  I think it might be possible to check mod_perl's version with
the existing check_module_version method, but I'll do some more
looking/digging/thinking.

I'd also like to see if it's possible to add support for building
mod_perl 1.x and mod_perl 2.x modules from the same distribution --
basically put Stas's code into this somewhere.

Thanks.
--
James Smith <JG...@TAMU.Edu>, 979-862-3725
Senior Software Applications Developer,
Texas A&M CIS Operating Systems Group, Unix

Re: [RFC] Apache::Build

Posted by Stas Bekman <st...@stason.org>.
James G Smith wrote:
> I've been moving several of my Perl modules from MakeMaker to
> Module::Build.  I'm not seeing support for Module::Build in the
> Apache::Test suite, so I thought I'd take a stab at subclassing
> Module::Build to provide support for it.

You are talking about a similar kind of wrappers to ModPerl::MM (for 3rd party 
modules) and ModPerl::BuildMM (for mp2 itself), right? Looks like ModPerl::MB 
is the right place then, using the same mnemonics...

> I couldn't access the searchable archives for this list (get sent
> back to http://www.apache.org/), but I did look through this month's
> archive and didn't see anything obvious along this line.

I don't remember any detailed discussions regarding MB. However a good archive 
is here: http://marc.theaimsgroup.com/?l=apache-test-dev
linked from:
http://perl.apache.org/maillist/test-dev.html#Searchable_Archives

> Several questions before I jump even more head-long into this.
> 
> (1) Is Apache::Build a sensible, everyday name?  Should it perhaps
> reside instead under Module::Build or Apache::Test?  I have no
> problem with this module being its own distribution on CPAN.  I also
> have no problem contributing it to an existing project.

modperl-2.0/lib/ModPerl/MB.pm ?

> (2) How DWIMmy should it be?  I like the following for my Build.PL
> (as a goal):
> 
>  use Apache::Build;
>  my $build = Apache::Build->new (
>      module_name => 'Apache::Foo',
>      license => 'perl',
>      requires => {
>          'perl'           => '5.6.1',
>          'Some::Module'   => '1.23',
>          'Other::Module'  => '>= 1.2, != 1.5, < 2.0',
>      },
>  );
>  $build->create_build_script;
> 
> It should just work :)  This would also make any t/*.PL files into
> t/* files.

I haven't used M::B yet, so I have no comments.

> (3) Support for multiple versions of Apache/mod_perl.

You mean across 1.0 and 2.0? In that case it shouldn't live in the mp2 distro. 
  Or it should have a dual life on CPAN, which is not quite supported by PAUSE 
yet.

> I'd also like to see if it's possible to add support for building
> mod_perl 1.x and mod_perl 2.x modules from the same distribution --
> basically put Stas's code into this somewhere.

Which code you are referring to?

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com