File Coverage

blib/lib/Parse/Matroska/Utils.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 24 24 100.0


line stmt bran cond sub pod time code
1 2     2   20970 use strict;
  2         5  
  2         70  
2 2     2   10 use warnings;
  2         4  
  2         107  
3              
4             # ABSTRACT: internally-used helper functions
5             package Parse::Matroska::Utils;
6             {
7             $Parse::Matroska::Utils::VERSION = '0.003';
8             }
9              
10 2     2   8 use Exporter;
  2         10  
  2         401  
11             our @ISA = qw{Exporter};
12             our @EXPORT_OK = qw{uniq uncamelize};
13              
14             sub uniq(@) {
15 27     27 1 27 my %seen;
16 27         42 return grep { !$seen{$_}++ } @_;
  112         274  
17             }
18              
19             sub uncamelize($) {
20 122     122 1 570 local $_ = shift;
21             # lc followed by UC: lc_UC
22 122         543 s/(?<=[a-z])([A-Z])/_\L$1/g;
23             # UC followed by two lc: _UClclc
24 122         484 s/([A-Z])(?=[a-z]{2})/_\L$1/g;
25             # strip leading _ that the second regexp might add; lowercase all
26 122         273 s/^_//; lc
27 122         402 }
28              
29             __END__