File Coverage

blib/lib/Locale/Maketext/Lexicon/DBI.pm
Criterion Covered Total %
statement 9 17 52.9
branch 0 2 0.0
condition n/a
subroutine 3 4 75.0
pod 0 1 0.0
total 12 24 50.0


line stmt bran cond sub pod time code
1             package Locale::Maketext::Lexicon::DBI;
2              
3 1     1   25684 use strict;
  1         3  
  1         44  
4 1     1   7 use warnings;
  1         2  
  1         30  
5              
6 1     1   968 use version; our $VERSION = qv("0.2.1");
  1         5859  
  1         8  
7              
8             sub parse {
9 0     0 0   my ($class, %param) = @_;
10              
11 0           my $dbh = $param{dbh};
12 0           my $sth = $dbh->prepare("SELECT lex_key, lex_value FROM lexicon WHERE lex = ? AND lang = ?");
13              
14 0 0         $sth->execute($param{lex}, $param{lang})
15             or warn "Error while fetching the lexicon. You may missed the incompatibility change in v0.2.0, see\n"
16             . " perldoc Locale::Maketext::Lexicon::DBI\nThe error was: "
17             . $sth->errstr;
18              
19 0           my %lexicon;
20 0           while (my ($key, $value) = $sth->fetchrow) {
21 0           $lexicon{$key} = $value;
22             }
23              
24 0           return \%lexicon;
25             }
26              
27             1;
28              
29             __END__