SearchBuilder/Util.pm

filter: Statementstmt 100% 14 / 14 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 21 / 21 CC 2 SCAR 3.4
CC
2
Cov
100%
sorted_values
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« SearchBuilder/Union.pm ↑ Summary SearchBuilder/Handle/mysqlPP.pm »
1 26 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 26 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package DBIx::SearchBuilder::Util;
5 26 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 26 our @EXPORT_OK = qw(
8 sorted_values
9 );
10  
11 =head1 NAME
12  
13 DBIx::SearchBuilder::Util - Utility and convenience functions for DBIx::SearchBuilder
14  
15 =head1 SYNOPSIS
16  
17 use DBIx::SearchBuilder::Util qw( sorted_values ); # or other function you want
18  
19 =head1 EXPORTED FUNCTIONS
20  
21 =head2 sorted_values
22  
23 Takes a hash or hashref and returns the values sorted by their respective keys.
24  
25 Equivalent to
26  
27 map { $hash{$_} } sort keys %hash
28  
29 but far more convenient.
30  
31 =cut
32  
33 693 ▶sub sorted_values {
Subroutine sorted_values: called CC=2 SCAR=6.9
Pod documented
34 693 ▶ my $hash = @_ == 1 ? $_[0] : { @_ };
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 ? : 687 6 693
35 693 return map { $hash->{$_} } sort keys %$hash;
36 }
37  
38 =head1 LICENSE AND COPYRIGHT
39  
40 Copyright (c) 2013 Best Practical Solutions, LLC. All rights reserved.
41  
42 This library is free software; you can redistribute it and/or modify it under
43 the same terms as Perl itself.
44  
45 =cut
46  
47 26 1;
« SearchBuilder/Union.pm ↑ Summary SearchBuilder/Handle/mysqlPP.pm »