Data/Unixish/shuf.pm

filter: Statementstmt 77.4% 24 / 31 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 75.6% 31 / 41 CC 3 SCAR 15.4
CC
3
Cov
73%
shuf
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.7
« Data/Unixish/grep.pm ↑ Summary Data/Unixish/wrap.pm »
1 package Data::Unixish::shuf;
2  
3 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use syntax 'each_on_array'; # to support perl < 5.12
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 #use Log::Any '$log';
8  
9 1 ▶use Data::Unixish::Util qw(%common_args);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use List::Util qw(shuffle);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
13 1 our $DATE = '2025-02-24'; # DATE
14 1 our $DIST = 'Data-Unixish'; # DIST
15 1 our $VERSION = '1.574'; # VERSION
16  
17 1 our %SPEC;
18  
19 $SPEC{shuf} = {
20 1 v => 1.1,
21 summary => 'Shuffle items',
22 args => {
23 %common_args,
24 },
25 tags => [qw/ordering/],
26 };
27 0 ▶sub shuf {
Subroutine shuf: not called CC=3 SCAR=24.8
Pod documented
28 0 my %args = @_;
29 0 my ($in, $out) = ($args{in}, $args{out});
30  
31 0 my @tmp;
32 0 ▶ while (my ($index, $item) = each @$in) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each @$in) 0 0 0
33 0 push @tmp, $item;
34 }
35  
36 0 push @$out, $_ for shuffle @tmp;
37 0 [200, "OK"];
38 }
39  
40 1 1;
41 # ABSTRACT: Shuffle items
42  
43 __END__
« Data/Unixish/grep.pm ↑ Summary Data/Unixish/wrap.pm »