* logfh is a HANDLE, not a SCALAR
spec => {bug_num => {type => SCALAR,
optional => 1,
},
spec => {bug_num => {type => SCALAR,
optional => 1,
},
- logfh => {type => SCALAR,
+ logfh => {type => HANDLE,
optional => 1,
},
log_name => {type => SCALAR,
optional => 1,
},
log_name => {type => SCALAR,
that file. Throws exceptions using die(), so you may want to wrap this in an
eval().
that file. Throws exceptions using die(), so you may want to wrap this in an
eval().
+Uses exactly the same options as Debbugs::Log::new
+
-sub read_log_records (*)
+ my %param;
+ if (@_ == 1) {
+ ($param{logfh}) = @_;
+ }
+ else {
+ %param = validate_with(params => \@_,
+ spec => {bug_num => {type => SCALAR,
+ optional => 1,
+ },
+ logfh => {type => HANDLE,
+ optional => 1,
+ },
+ log_name => {type => SCALAR,
+ optional => 1,
+ },
+ }
+ );
+ }
+ 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";
+ }
- my $reader = Debbugs::Log->new($logfh);
+ my $reader = Debbugs::Log->new(%param);
while (defined(my $record = $reader->read_record())) {
push @records, $record;
}
while (defined(my $record = $reader->read_record())) {
push @records, $record;
}