JobQueue/Sort.pm

filter: Statementstmt 88.5% 31 / 35 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 20.0% 1 / 5 totaltotal 79.2% 42 / 53 CC 3 SCAR 3.9
CC
3
Cov
85%
describe
2.1
command
2.0
failed
2.0
CRAP 1.5
« JobQueue/Move.pm ↑ Summary JobQueue/Sequence.pm »
1  
2 package Proc::JobQueue::Sort;
3  
4 # $Id: Sort.pm 13848 2009-07-23 21:34:00Z david $
5  
6 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 require Proc::JobQueue::Job;
9 3 our @ISA = qw(Proc::JobQueue::Job);
10 3 ▶use Tie::Function::Examples qw(%q_shell);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 use overload
13 3 ▶ '""' => \&describe;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 sub new
16 40 ▶{
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
17 40 my ($pkg, $opts, $config, $dest, @inputs) = @_;
18 40 return $pkg->SUPER::new(
19 config => $config,
20 opts => $opts,
21 dest => $dest,
22 inputs => \@inputs,
23 desc => "Sort to $dest",
24 );
25 }
26  
27 sub describe
28 140 ▶{
Subroutine describe: called CC=2 SCAR=7.2
Pod undocumented
29 140 my ($job) = @_;
30 140 ▶ if (@{$job->{inputs}} > 5) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$job->{'inputs'};} > 5) { } 0 140 140
31 0 return "Sort $job->{inputs}[0], $job->{inputs}[1] ... > $job->{dest}";
32 } else {
33 140 return "Sort @{$job->{inputs}} > $job->{dest}";
34 }
35 }
36  
37 sub command
38 40 ▶{
Subroutine command: called CC=2 SCAR=7.1
Pod undocumented
39 40 my ($job) = @_;
40 40 my $mem = '';
41 40 my $config = $job->{config};
42 40 ▶ if ($config->{unix_sort_memory_buffer}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($config->{"unix_sort_memory_buffer"}) 0 40 40
43 0 $mem = "--buffer-size=$config->{unix_sort_memory_buffer}";
44 }
45 40 return "sort $mem -o $q_shell{$job->{dest}} @q_shell{@{$job->{inputs}}}";
46 }
47  
48 sub success
49 40 ▶{
Subroutine success: called CC=1 SCAR=0.0
Pod undocumented
50 40 my ($job) = @_;
51 40 unlink(@{$job->{inputs}});
52 }
53  
54 sub failed
55 0 ▶{
Subroutine failed: not called CC=1 SCAR=6.9
Pod documented
56 0 my ($job) = @_;
57 0 unlink($job->{dest});
58 }
59  
60 3 1;
61  
62 __END__
« JobQueue/Move.pm ↑ Summary JobQueue/Sequence.pm »