script/marcstats.pl untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 5 Podpod n/a totaltotal 0.0% 0 / 49 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2 use warnings;
3 use strict;
4  
5 use MARC::Record::Stats;
6 use MARC::File::USMARC;
7  
8 use Getopt::Euclid;
9  
10 my $stats = MARC::Record::Stats->new();
11  
12 foreach my $fn ( @{ $ARGV{'<file>'} } ) {
13 my $batch = MARC::File::USMARC->in( $fn )
14 or warn "Can't read the file $fn\n";
15 next unless $batch;
16
17 while ( my $record = $batch->next() ) {
18 $stats->add_record_to_stats($record);
19 }
20
21 $batch->close();
22 undef $batch;
23 }
24  
25 my $out;
26 if ( my $fn = $ARGV{'-o'} ) {
27 open $out, ">", "$fn";
28 }
29 else {
30 $out = *STDOUT
31 }
32  
33 my $config = { };
34 $config->{dots} = $ARGV{'--dots'};
35 $stats->report($out, $config);
36  
37 if ( $ARGV{'-o'} ) { close $out; }
38  
39 __END__