lib/Archive/BagIt/App/Verify.pm

filter: Statementstmt 62.5% 20 / 32 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 2 totaltotal 55.5% 25 / 45 CC 3 SCAR 10.5
CC
3
Cov
56%
run
6.3
abstract
2.0
BEGIN
1.0
CRAP 2.9
↑ Summary script/bagit.pl »
1 package Archive::BagIt::App::Verify;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '0.049'; # VERSION
7  
8 1 ▶use MooseX::App::Command;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 parameter 'bag_path' => (
11 is=>'rw',
12 isa=>'Str',
13 documentation => q[This is the path to run verify on],
14 required => 1,
15 );
16  
17 1 option 'return_all_errors' => (
18 is => 'rw',
19 isa => 'Bool',
20 documentation => q[collect all errors rather than dying on first],
21 );
22  
23 1 option 'fast' => (
24 is => 'rw',
25 isa => 'Bool',
26 documentation => q[use Archive::BagIt::Fast instead...],
27 );
28  
29  
30 0 ▶sub abstract {
Subroutine abstract: not called CC=1 SCAR=6.9
Pod undocumented
31 0 return 'verifies a valid bag';
32 }
33  
34  
35 0 ▶sub run {
Subroutine run: not called CC=3 SCAR=18.4
Pod undocumented
36 0 my ( $self) = @_;
37  
38 1 ▶ use Archive::BagIt;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 0 my $bag_path = $self->bag_path;
40 0 my ($bag);
41 0 ▶ if($self->fast) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->fast) { } 0 0 0
42 1 ▶ use Archive::BagIt::Fast;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 0 $bag = Archive::BagIt::Fast->new($bag_path);
44 }
45 else {
46 0 $bag = Archive::BagIt->new($bag_path);
47 }
48 0 eval {
49 0 $bag->verify_bag();
50 };
51 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 0 0 0
52 0 print "FAIL: ".$bag_path." : $! $@\n";
53 }
54 else {
55 0 print "PASS: ".$bag_path."\n";
56 }
57 }
58  
59 1 1
60  
61 __END__
↑ Summary script/bagit.pl »