Cmd/Command/Load.pm

filter: Statementstmt 84.3% 27 / 32 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 81.4% 35 / 43 CC 4 SCAR 10.8
CC
4
Cov
79%
__ANON__
4.9
BEGIN
1.0
BEGIN
1.0
CRAP 2.9
« Cmd.pm ↑ Summary Cmd/Command/Edit.pm »
1 #!/usr/bin/perl
2  
3 package KiokuDB::Cmd::Command::Load;
4 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use KiokuDB::Entry;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use KiokuDB::Reference;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 extends qw(KiokuDB::Cmd::Base);
12  
13 1 with qw(
14 KiokuDB::Cmd::WithDSN::Create
15 KiokuDB::Cmd::DumpFormatter
16 KiokuDB::Cmd::InputHandle
17 );
18  
19 3 ▶augment run => sub {
Subroutine __ANON__: called CC=4 SCAR=15.9
20 3 my $self = shift;
21  
22 3 my $b = $self->backend;
23  
24 3 my $in = $self->input_handle;
25 3 my $ser = $self->serializer;
26  
27 3 my $i = my $j = 0;
28  
29 3 ▶ while ( my @entries = $ser->deserialize_from_stream($in) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@entries) = $ser->deserialize_from_stream($in)) 26 2 28
30 26 ▶ if ( $self->verbose ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->verbose) 0 26 26
31 0 $i += @entries;
32 0 $j += @entries;
33  
34 0 ▶ if ( $j > 13 ) { # luv primes
Branch: 1 branch
BranchTrueFalseTotal
if ($j > 13) 0 0 0
35 0 $j = 0;
36 0 $self->v("\rloading... $i");
37 }
38 }
39  
40 26 $b->insert(@entries);
41 }
42  
43 2 $self->v("\rloaded $i entries \n");
44  
45 2 $self->try_txn_commit($b);
46 1 };
47  
48 1 __PACKAGE__->meta->make_immutable;
49  
50 1 __PACKAGE__
51  
52 __END__
« Cmd.pm ↑ Summary Cmd/Command/Edit.pm »