| 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
| |||||||||||
| 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
| |||||||||||
| 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__ | ||||||||||