Brackup/Chunker/Default.pm

filter: Statementstmt 100% 18 / 18 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 95.8% 23 / 24 CC 2 SCAR 4.1
CC
2
Cov
100%
chunks
2.0
BEGIN
1.0
_min
1.0
CRAP 1.5
« Brackup/TargetBackupStatInfo.pm ↑ Summary Brackup/InventoryDatabase.pm »
1 package Brackup::Chunker::Default;
2 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 57 ▶sub chunks {
Subroutine chunks: called CC=2 SCAR=6.9
Pod undocumented
5 57 my ($class, $file) = @_;
6 57 my @chunk_list;
7  
8 57 my $root = $file->root;
9 57 my $chunk_size = $root->chunk_size;
10 57 my $size = $file->size;
11  
12 57 my $offset = 0;
13 57 ▶ while ($offset < $size) {
Branch: 1 branch
BranchTrueFalseTotal
if ($offset < $size) 69 57 126
14 69 my $len = _min($chunk_size, $size - $offset);
15 69 my $chunk = Brackup::PositionedChunk->new(
16 file => $file,
17 offset => $offset,
18 length => $len,
19 );
20 69 push @chunk_list, $chunk;
21 69 $offset += $len;
22 }
23 57 return @chunk_list;
24 }
25  
26 69 ▶sub _min {
Subroutine _min: called CC=1 SCAR=0.0
27 69 return (sort { $a <=> $b } @_)[0];
28 }
29  
30 13 1;
« Brackup/TargetBackupStatInfo.pm ↑ Summary Brackup/InventoryDatabase.pm »