From 6586bc85c0c0ec2ab2de70dc7d76e72c43e62f7e Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Thu, 29 Sep 2005 13:43:32 +0000 Subject: Reports errors on STDERR, not STDOUT --- Distribconf/Build.pm | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'Distribconf/Build.pm') diff --git a/Distribconf/Build.pm b/Distribconf/Build.pm index 4d22ec6..fb710a3 100644 --- a/Distribconf/Build.pm +++ b/Distribconf/Build.pm @@ -152,23 +152,23 @@ sub write_version { } -=head2 check($out) +=head2 check($fhout) -Perform a check on the distribution and print to $out (STDOUT by default) -errors found +Performs a check on the distribution and prints to $fhout (STDERR by default) +warnings and errors found. =cut sub check { - my ($distrib, $out) = @_; - $out ||= \*STDOUT; + my ($distrib, $fhout) = @_; + $fhout ||= \*STDERR; my $error = 0; my $report_err = sub { my ($l, $f, @msg) = @_; $l eq 'E' and $error++; - printf $out "$l: $f\n", @msg; + printf $fhout "$l: $f\n", @msg; }; $distrib->listmedia or $report_err->('W', "No media found in this config"); @@ -193,19 +193,18 @@ sub check { } foreach my $media ($distrib->listmedia) { - -d $distrib->getfullpath($media, 'path') or - $report_err->('E', "dir %s does't exist for media '%s'", - $distrib->getpath($media, 'path'), - $media - ); - - foreach (qw/hdlist synthesis pubkey/) { - -f $distrib->getfullpath($media, $_) or - $report_err->('E', "$_ %s doesn't exist for media '%s'", - $distrib->getpath($media, $_), - $media - ); - } + -d $distrib->getfullpath($media, 'path') or $report_err->( + 'E', "dir %s does't exist for media '%s'", + $distrib->getpath($media, 'path'), + $media + ); + foreach (qw/hdlist synthesis pubkey/) { + -f $distrib->getfullpath($media, $_) or $report_err->( + 'E', "$_ %s doesn't exist for media '%s'", + $distrib->getpath($media, $_), + $media + ); + } } return $error; } @@ -232,6 +231,9 @@ Thanks to Sylvie Terjan for the spell checking. =head1 ChangeLog $Log$ + Revision 1.6 2005/09/29 13:43:32 rgarciasuarez + Reports errors on STDERR, not STDOUT + Revision 1.5 2005/09/29 12:28:04 rgarciasuarez Spell check error message -- cgit v1.2.1