File Coverage

blib/lib/Sort/Naturally/XS.pm
Criterion Covered Total %
statement 22 22 100.0
branch 3 4 75.0
condition 1 2 50.0
subroutine 6 6 100.0
pod 1 1 100.0
total 33 35 94.2


line stmt bran cond sub pod time code
1             package Sort::Naturally::XS;
2              
3 5     5   348647 use 5.010001;
  5         56  
4 5     5   24 use strict;
  5         9  
  5         102  
5 5     5   38 use warnings;
  5         9  
  5         129  
6 5     5   22 use Carp;
  5         9  
  5         319  
7              
8             require Exporter;
9 5     5   2201 use AutoLoader;
  5         6366  
  5         23  
10              
11             our @ISA = qw/Exporter/;
12              
13             our @EXPORT = qw/ncmp nsort/;
14              
15             our @EXPORT_OK = qw/sorted/;
16              
17             our $VERSION = '0.7.9';
18              
19             require XSLoader;
20             XSLoader::load('Sort::Naturally::XS', $VERSION);
21              
22             sub sorted {
23 11     11 1 12784 my ($ar, %kwargs) = @_;
24              
25 11 50       39 Carp::confess('Not an ARRAY ref') if (ref $ar ne 'ARRAY');
26              
27 11         15 my $ar_copy = [@{$ar}];
  11         36  
28 11 100       28 my $reverse = $kwargs{reverse} ? 1 : 0;
29 11   50     38 my $locale = $kwargs{locale} || '';
30              
31 11         264 _sorted($ar_copy, $reverse, $locale);
32              
33 11         50 return $ar_copy;
34             }
35              
36             # Preloaded methods go here.
37              
38             # Autoload methods go after =cut, and are processed by the autosplit program.
39              
40             1;
41             __END__