blib/lib/Sort/Key.pm

filter: Statementstmt 95.3% 41 / 43 Branchbran 66.6% 8 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 66.6% 2 / 3 totaltotal 87.8% 58 / 66 CC 7 SCAR 10.3
CC
7
Cov
89%
multikeysorter
4.0
multikeysorter_inplace
4.0
register_type
2.0
CRAP 2.8
« blib/lib/Sort/Key/Multi.pm ↑ Summary blib/lib/Sort/Key/Register.pm »
1 package Sort::Key;
2  
3 5 our $VERSION = '1.33';
4  
5 5 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 5 ▶use Sort::Key::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 5 require Exporter;
14  
15 5 our @ISA = qw(Exporter);
16 5 our @EXPORT_OK = qw( nsort nsort_inplace
17 isort isort_inplace
18 usort usort_inplace
19 rsort rsort_inplace
20 rnsort rnsort_inplace
21 risort risort_inplace
22 rusort rusort_inplace
23  
24 keysort keysort_inplace
25 rkeysort rkeysort_inplace
26 nkeysort nkeysort_inplace
27 rnkeysort rnkeysort_inplace
28 ikeysort ikeysort_inplace
29 rikeysort rikeysort_inplace
30 ukeysort ukeysort_inplace
31 rukeysort rukeysort_inplace
32  
33 multikeysorter multikeysorter_inplace);
34  
35 5 require XSLoader;
36 5 XSLoader::load('Sort::Key', $VERSION);
37  
38 13 ▶sub multikeysorter {
Subroutine multikeysorter: called CC=4 SCAR=13.9
Pod documented
39 13 ▶ if (ref $_[0] eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] eq 'CODE') { } 6 7 13
40 6 my $keygen = shift;
41 6 ▶ @_ or croak "too few keys";
Branch: 1 branch
BranchTrueFalseTotal
@_ or croak("too few keys") 6 0 6
42 6 my $ptypes = Sort::Key::Types::combine_types(@_);
43 6 my $sub = Sort::Key::Types::combine_sub($keygen, undef, @_);
44 6 return _multikeysorter($ptypes, $sub, undef);
45 }
46 else {
47 7 ▶ @_ or croak "too few keys";
Branch: 1 branch
BranchTrueFalseTotal
@_ or croak("too few keys") 7 0 7
48 7 my $ptypes = Sort::Key::Types::combine_types(@_);
49 7 my $sub = Sort::Key::Types::combine_sub('@_', undef, @_);
50 7 return _multikeysorter($ptypes, undef, $sub)
51 }
52 }
53  
54 11 ▶sub multikeysorter_inplace {
Subroutine multikeysorter_inplace: called CC=4 SCAR=13.9
Pod documented
55 11 ▶ if (ref $_[0] eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] eq 'CODE') { } 6 5 11
56 6 my $keygen = shift;
57 6 ▶ @_ or croak "too few keys";
Branch: 1 branch
BranchTrueFalseTotal
@_ or croak("too few keys") 6 0 6
58 6 my $ptypes = Sort::Key::Types::combine_types(@_);
59 6 my $sub = Sort::Key::Types::combine_sub($keygen, undef, @_);
60 6 return _multikeysorter_inplace($ptypes, $sub, undef);
61 }
62 else {
63 5 ▶ @_ or croak "too few keys";
Branch: 1 branch
BranchTrueFalseTotal
@_ or croak("too few keys") 5 0 5
64 5 my $ptypes = Sort::Key::Types::combine_types(@_);
65 5 my $sub = Sort::Key::Types::combine_sub('@_', undef, @_);
66 5 return _multikeysorter_inplace($ptypes, undef, $sub);
67 }
68 }
69  
70 0 ▶sub register_type {
Subroutine register_type: not called CC=1 SCAR=6.9
Pod undocumented
71 0 warn "Warning, Sort::Key API changed: register_type function has been moved to module Sort::Key::Types";
72 0 goto &Sort::Key::Types::register_type;
73 }
74  
75  
76 5 1;
77  
78 __END__
« blib/lib/Sort/Key/Multi.pm ↑ Summary blib/lib/Sort/Key/Register.pm »