On Mon, Mar 21, 2005 at 09:57:26AM -0600, Ken Williams wrote:
> 
> On Mar 20, 2005, at 4:09 PM, Yitzchak Scott-Thoennes wrote:
> >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;
> >}
> 
> It would probably be better to set $@ or another global.  Using 
> inout-style arguments is a little unexpected these days unless the arg 
> is a reference to a data structure.

I find the output via args a lot cleaner.  Even so, I would agree with
you except that the only user of this module
(lib/MakeMaker/Test/Utils.pm) is the makemaker test suite.  I'm going
to try to work on a patch that does this.

An alternative would be to have have_compiler return ($have_compiler,
$errmsg) if wantarray.  That makes the code in the caller more clunky
though (IMO).  Another alternative would be to rename the thing
no_compiler, returning undef or an explanation.  But I'm not going to
pursue these alternatives unless someone likes them better.

Reply via email to