develooper Front page | perl.qa | Postings from March 2005

Re: Test::META

Thread Previous | Thread Next
From:
Randy W. Sims
Date:
March 28, 2005 16:21
Subject:
Re: Test::META
Message ID:
42489F71.7020800@thepierianspring.org
Christopher H. Laco wrote:
> Michael G Schwern wrote:
> 
>> On Mon, Mar 28, 2005 at 08:42:50AM -0500, Christopher H. Laco wrote:
>>
>>> That's another gripe of mine about M::B and create_makefile_pl.
>>> It puts the requires AND build_requires in the PREREQ_PM in the 
>>> Makefile.PL, which I won't want; nor do I think it right for everyone.
>>
>>
>>
>> There is no build_requires or recommends equivalent in MakeMaker, nor 
>> will there be, so putting it into PREREQ_PM is the best thing to do.  
>> That's
>> what every MakeMaker-based module on CPAN does after all.
>>
>> Its better than just dropping it and having the build fail.
> 
> 
> That's a matter of opinion; one I think should be left up to the person 
> makeing Build.PL.

err, it is up to the Build.PL author. You do the same thing you would do 
with Makefile.PL, if it doesn't belong don't put it there. Simply modify 
the target which in Build.PL would look something like:

   use Module::Build;
   my $class = Module::Build->subclass(code => <<'EOF');
     sub ACTION_test {
       my $self = shift;
       die "Missing test dependency\n" unless eval { use Foo::Bar; };
       return $self->SUPER::ACTION_test;
     }
   EOF

   my $builder = $class->new( ... );

   $builder->create_build_script();

Maybe there should be a test_requires option, but the above isn't any 
different or uglier than what MakeMaker requires.

I think someone had proposed a year or two ago that there should be a 
test_requires options and I argued against it. Now, I think maybe it was 
a good idea; especially, since the number of extra testing modules being 
used have increased a lot over that time.

Randy.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About