File Coverage

blib/lib/Locale/Maketext/Lexicon/Properties.pm
Criterion Covered Total %
statement 28 28 100.0
branch 3 4 75.0
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 38 40 95.0


line stmt bran cond sub pod time code
1             package Locale::Maketext::Lexicon::Properties;
2 3     3   125252 use 5.008005;
  3         10  
  3         119  
3 3     3   18 use strict;
  3         6  
  3         96  
4 3     3   25 use warnings;
  3         5  
  3         115  
5 3     3   1016 use utf8;
  3         14  
  3         24  
6 3     3   3240 use Encode ();
  3         35120  
  3         69  
7 3     3   877 use Locale::Maketext::Lexicon;
  3         2874  
  3         53  
8              
9             our $VERSION = "0.03";
10              
11             sub parse {
12 2     2 0 637 my $self = shift;
13              
14 2         6 my @out;
15 2         5 for (@_) {
16 6 100       21 if (Locale::Maketext::Lexicon::option('decode')) {
17 2         20 $_ = Encode::decode_utf8($_);
18             }
19              
20             # e.g.
21             # foo=bar\r\n
22             # ~~~ ~~~
23             # $1 $2
24 6 50       139 if (/\A[ \t]*([^=]+?)[ \t]*=[ \t]*(.+?)[\015\012]*\z/) {
25 6         17 my ($key, $value) = ($1,$2);
26 6         16 $value =~ s!\\n!\n!g;
27 6         16 push @out, $key, $value;
28             }
29             }
30 2         12 return +{ @out };
31             }
32              
33             1;
34             __END__