From: Don Armstrong Date: Thu, 19 Jun 2008 21:23:47 +0000 (-0700) Subject: use carp; fix $bug usage; fix grep command X-Git-Tag: release/2.6.0~488^2~33 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=675a95f52de1ddd355f5079fe39600b52b16084f;p=debbugs.git use carp; fix $bug usage; fix grep command --- diff --git a/Debbugs/Log.pm b/Debbugs/Log.pm index d36bbe5..97f0b00 100644 --- a/Debbugs/Log.pm +++ b/Debbugs/Log.pm @@ -35,6 +35,7 @@ BEGIN { $EXPORT_TAGS{all} = [@EXPORT_OK]; } +use Carp; use Debbugs::Common qw(getbuglocation getbugcomponent); use Params::Validate qw(:types validate_with); @@ -177,7 +178,7 @@ sub new } ); } - if (grep {exists $param{$_} and defined $param{$_}} qw(bug_num logfh log_name) ne 3) { + if (grep({exists $param{$_} and defined $param{$_}} qw(bug_num logfh log_name)) ne 1) { croak "Exactly one of bug_num, logfh, or log_name must be passed and must be defined"; } @@ -193,8 +194,8 @@ sub new die "Unable to open bug log $param{log_name} for reading: $!"; } elsif (exists $param{bug_num}) { - my $location = getbuglocation($bug,'log'); - my $bug_log = getbugcomponent($bug,'log',$location); + my $location = getbuglocation($param{bug_num},'log'); + my $bug_log = getbugcomponent($param{bug_num},'log',$location); $self->{logfh} = IO::File->new($bug_log, 'r') or die "Unable to open bug log $bug_log for reading: $!"; }