blib/lib/Magpie/Util.pm

filter: Statementstmt 100% 11 / 11 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod 0.0% 0 / 1 totaltotal 94.7% 18 / 19 CC 4 SCAR 13.9
CC
4
Cov
100%
make_tuples
4.0
CRAP 4.0
« blib/lib/Magpie/Dispatcher/Env.pm ↑ Summary blib/lib/Magpie/Dispatcher/RequestParam.pm »
1 package Magpie::Util;
2 49 $Magpie::Util::VERSION = '1.141660';
3 # ABSTRACT: Common utility functions
4  
5 #-------------------------------------------------------------------------------
6 # internal convenience for regularizing potentially uneven lists of name/param
7 # hash pairs
8 #-------------------------------------------------------------------------------
9 sub make_tuples {
10 122 ▶ my @in = @_;
Subroutine make_tuples: called CC=4 SCAR=13.9
Pod undocumented
11 122 my @out = ();
12 122 ▶ for (my $i = 0; $i < scalar @in; $i++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @in) 528 122 650
13 528 ▶ next if ref( $in[$i] ) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $in[$i] eq "HASH" 137 391 528
14 391 my $args = {};
15 391 ▶ if ( ref( $in[$i + 1 ]) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $in[$i + 1] eq "HASH") 135 256 391
16 135 $args = $in[$i + 1 ];
17 }
18 391 push @out, [$in[$i], $args];
19 }
20 122 return @out;
21 }
22  
23 49 1;
24  
25 __END__
26 =pod
27  
28 =head1 NAME
29  
30 Magpie::Util - Common utility functions
31  
32 =head1 VERSION
33  
34 version 1.141660
35  
36 =head1 AUTHORS
37  
38 =over 4
39  
40 =item *
41  
42 Kip Hampton <kip.hampton@tamarou.com>
43  
44 =item *
45  
46 Chris Prather <chris.prather@tamarou.com>
47  
48 =back
49  
50 =head1 COPYRIGHT AND LICENSE
51  
52 This software is copyright (c) 2011 by Tamarou, LLC.
53  
54 This is free software; you can redistribute it and/or modify it under
55 the same terms as the Perl 5 programming language system itself.
56  
57 =cut
58  
« blib/lib/Magpie/Dispatcher/Env.pm ↑ Summary blib/lib/Magpie/Dispatcher/RequestParam.pm »