On Sun, Mar 20, 2005 at 01:47:38PM -0800, Michael G Schwern wrote:
> On Sun, Mar 20, 2005 at 12:08:54PM -0800, Yitzchak Scott-Thoennes wrote:
> > > There is no equivalent in MakeMaker.  
> > 
> > And you can't hand-alter the META.yml?
> 
> Yes but then I would have to turn off the META.yml auto-generation for good.
> Also ExtUtils::CBuilder is an optional build requirement.  Its not worth the
> trouble.
> 
> I don't think the CPAN shells read the MakeMaker META.yml anyway.
> 
> 
> > Easiest thing to do would be to have have_compiler itself return a string
> > describing the problem.
> 
> $ perl -wle 'sub foo { return "strings are true" }  print "Strings are true" 
> if foo()'
> Strings are true
> 
> The classic problem of return value vs error value.  How to convey both.

I was thinking along the lines of:


if (have_compiler($errmsg)) {
    plan tests => 1;
} else {
    plan skip_all => $errmsg;   
}



sub have_compiler {
   my $errmsg = "";

   ...

   $_[0] = $errmsg if @_;
   return $have_compiler;
}

where errmsg would be one of:
   Unable to load ExtUtils::CBuilder
   ExtUtils::CBuilder->new failed    (this would be pretty unusual)
or Unable to find a compiler

Reply via email to