Author: ericwilhelm
Date: Sun Sep 28 02:21:14 2008
New Revision: 11892
Modified:
Module-Build/trunk/lib/Module/Build/Base.pm
Log:
lib/Module/Build/Base.pm - pseudo-extracted the longest() util
Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm Sun Sep 28 02:21:14 2008
@@ -1125,10 +1125,19 @@
$self->log_info("Checking features:\n");
- my $max_name_len = 0;
- $max_name_len = ( length($_) > $max_name_len ) ?
- length($_) : $max_name_len
- for keys %$features;
+ # TODO refactor into ::Util
+ my $longest = sub {
+ my @str = @_ or croak("no strings given");
+
+ my @len = map({length($_)} @str);
+ my $max = 0;
+ my $longest;
+ for my $i (0..$#len) {
+ ($max, $longest) = ($len[$i], $str[$i]) if($len[$i] > $max);
+ }
+ return($longest);
+ };
+ my $max_name_len = length($longest->(keys %$features));
while (my ($name, $info) = each %$features) {
$self->log_info(" $name" . '.' x ($max_name_len - length($name) + 4));