Sort/Sub/asciibetically.pm

filter: Statementstmt 88.4% 23 / 26 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 2 totaltotal 81.4% 35 / 43 CC 5 SCAR 11.1
CC
5
Cov
85%
__ANON__
5.3
meta
2.0
gen_sorter
1.0
CRAP 3.0
« Sort/Sub/numerically_no_warning.pm ↑ Summary Test/Sort/Sub.pm »
1 package Sort::Sub::asciibetically;
2  
3 2 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
8 2 our $DATE = '2024-07-17'; # DATE
9 2 our $DIST = 'Sort-Sub'; # DIST
10 2 our $VERSION = '0.121'; # VERSION
11  
12 0 ▶sub meta {
Subroutine meta: not called CC=1 SCAR=6.9
Pod undocumented
13 return {
14 0 v => 1,
15 summary => 'Sort ascibetically (string-wise)',
16 };
17 }
18  
19 3 ▶sub gen_sorter {
Subroutine gen_sorter: called CC=1 SCAR=0.1
Pod undocumented
20 3 my ($is_reverse, $is_ci) = @_;
21  
22 34 ▶ sub {
Subroutine __ANON__: called CC=5 SCAR=16.6
23 2 ▶ no strict 'refs'; ## no critic: TestingAndDebugging::ProhibitNoStrict
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 34 my $caller = caller();
26 0 ▶ my $a = @_ ? $_[0] : ${"$caller\::a"};
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 34 0 34
27 0 ▶ my $b = @_ ? $_[1] : ${"$caller\::b"};
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 34 0 34
28  
29 34 ▶ my $cmp = $is_ci ? lc($a) cmp lc($b) : $a cmp $b;
Branch: 1 branch
BranchTrueFalseTotal
$is_ci ? : 23 11 34
30 34 ▶ $is_reverse ? -1*$cmp : $cmp;
Branch: 1 branch
BranchTrueFalseTotal
$is_reverse ? : 12 22 34
31 3 };
32 }
33  
34 2 1;
35 # ABSTRACT: Sort ascibetically (string-wise)
36  
37 __END__
« Sort/Sub/numerically_no_warning.pm ↑ Summary Test/Sort/Sub.pm »