perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Rolsky <auta...@urth.org>
Subject Style nit in all.t for A::SL
Date Fri, 25 Aug 2006 12:03:33 GMT
If you look at t/apache/all. tand t/apache2/all.t they both take this 
pattern:

  sub my_need {

      my $ok = 1;

      if ( $Config{'osname'} eq 'linux' ) {
          $ok = need_module('Linux::Pid');
          if ( -e '/proc/self/smaps' ) {
              $ok &= need_module('Linux::Smaps');
          }
      }
      elsif ( $Config{'osname'} =~ /(bsd|aix)/i ) {
          $ok &= need_module('BSD::Resource');
      }
      elsif ( $Config{'osname'} eq 'MSWin32' ) {
          $ok &= need_module('Win32::API');
      }

      $ok &= need_min_apache_version("2.0.48");

      eval { require mod_perl2; };
      $ok &= $mod_perl2::VERSION && $mod_perl2::VERSION >= 1.99022 ? 1 : 0;
 ## 2.0.0-RC5+

      $ok &= need_min_module_version('Test::Builder' => '0.18_01');

      return $ok;
  }

Instead of all the ok &= bits I think this'd be clearer if we just did
"return unless X" and then "return 1" at the end, because it tells the 
person reading the code that everything afterwards is basically irrelevant 
if any one test fails. As it stands, it makes you read the whole thing.


-dave

/*===================================================
VegGuide.Org                        www.BookIRead.com
Your guide to all that's veg.       My book blog
===================================================*/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message