File Coverage

blib/lib/File/Rename/Unicode.pm
Criterion Covered Total %
statement 23 23 100.0
branch 4 4 100.0
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 35 35 100.0


line stmt bran cond sub pod time code
1             package File::Rename::Unicode;
2            
3 3     3   64 use 5.032; # use 5.012;
  3         12  
4            
5 3     3   20 use strict;
  3         6  
  3         83  
6 3     3   14 use warnings;
  3         5  
  3         332  
7            
8 3     3   24 use Encode qw(encode decode);
  3         9  
  3         430  
9            
10             our $VERSION = '1.30';
11            
12             sub code {
13 3     3 1 7 my $code = shift;
14 3         5 my $encoding = shift;
15             return
16             sub {
17 3     3   36 use feature 'unicode_strings';
  3         5  
  3         1106  
18 3 100   3   16 if ( $encoding ) {
19 1         9 $_ = decode($encoding, $_);
20             }
21             else {
22 2         7 utf8::upgrade $_;
23             }
24 3         99 $code->();
25 3 100       20 if ( $encoding ) {
26 1         11 $_ = encode($encoding, $_);
27             }
28 3         18 };
29             }
30            
31             1;
32            
33             __END__