File Coverage

lib/Archive/BagIt/Role/OpenSSL.pm
Criterion Covered Total %
statement 31 34 91.1
branch n/a
condition n/a
subroutine 10 11 90.9
pod 1 1 100.0
total 42 46 91.3


line stmt bran cond sub pod time code
1             package Archive::BagIt::Role::OpenSSL;
2 12     12   154009 use strict;
  12         37  
  12         496  
3 12     12   67 use warnings;
  12         26  
  12         721  
4 12     12   5964 use Archive::BagIt::Role::OpenSSL::Async;
  12         49  
  12         555  
5 12     12   1908 use Class::Load qw(load_class);
  12         39367  
  12         950  
6 12     12   87 use Carp qw(carp);
  12         46  
  12         621  
7 12     12   511 use Moo::Role;
  12         8348  
  12         105  
8 12     12   8036 use namespace::autoclean;
  12         53  
  12         123  
9             # ABSTRACT: A role that handles plugin loading
10             our $VERSION = '0.101'; # VERSION
11              
12              
13             has 'async_support' => (
14             is => 'ro',
15             builder => '_check_async_support',
16             predicate => 1,
17             lazy => 1,
18             );
19              
20              
21             sub _get_hash_string_sync {
22 0     0   0 my ($self, $fh, $blksize)=@_;
23 0         0 my $obj = Archive::BagIt::Role::OpenSSL::Sync->new( name => $self->name);
24 0         0 return $obj->calc_digest($fh, $blksize);
25             }
26              
27             sub _get_hash_string_async {
28 540     540   1032 my ($self, $fh, $blksize) = @_;
29 540         696 my $result;
30 540         18463 my $obj = Archive::BagIt::Role::OpenSSL::Async->new(name => $self->name);
31 540         23775 return $obj->calc_digest($fh, $blksize);
32             }
33              
34              
35             sub get_hash_string {
36 540     540 1 1122 my ($self, $fh) = @_;
37 540         1835 my $blksize = $self->get_optimal_bufsize($fh);
38 540         1409 return $self->_get_hash_string_async($fh, $blksize);
39             }
40              
41 12     12   4131 no Moo;
  12         27  
  12         91  
42             1;
43              
44             __END__