File Coverage

blib/lib/Woothee/Util.pm
Criterion Covered Total %
statement 28 28 100.0
branch 4 4 100.0
condition 6 6 100.0
subroutine 10 10 100.0
pod 0 5 0.0
total 48 53 90.5


line stmt bran cond sub pod time code
1             package Woothee::Util;
2              
3 6     6   36 use strict;
  6         12  
  6         170  
4 6     6   31 use warnings;
  6         11  
  6         138  
5 6     6   32 use Carp;
  6         9  
  6         274  
6              
7 6     6   36 use Woothee::DataSet;
  6         11  
  6         517  
8              
9             our $VERSION = "1.7.0";
10              
11             our (@ISA, @EXPORT_OK);
12             BEGIN {
13 6     6   38 require Exporter;
14 6         68 our @ISA = qw(Exporter);
15 6         1597 our @EXPORT_OK = qw(update_map update_category update_version update_os update_os_version);
16             }
17              
18             sub update_map {
19 849     849 0 1423 my ($target,$source) = @_;
20 849         2525 foreach my $key (%$source) {
21 8292 100 100     13534 next if $key eq Woothee::DataSet->const('KEY_LABEL') or $key eq Woothee::DataSet->const('KEY_TYPE');
22 6594 100 100     15746 if (defined($source->{$key}) and length($source->{$key}) > 0) {
23 1908         3654 $target->{$key} = $source->{$key};
24             }
25             }
26             }
27              
28             sub update_category {
29 255     255 0 448 my ($target,$category) = @_;
30 255         525 $target->{Woothee::DataSet->const('ATTRIBUTE_CATEGORY')} = $category;
31             }
32              
33             sub update_version {
34 375     375 0 702 my ($target,$version) = @_;
35 375         724 $target->{Woothee::DataSet->const('ATTRIBUTE_VERSION')} = $version;
36             }
37              
38             sub update_os {
39 255     255 0 451 my ($target,$os) = @_;
40 255         521 $target->{Woothee::DataSet->const('ATTRIBUTE_OS')} = $os;
41             }
42              
43             sub update_os_version {
44 201     201 0 357 my ($target,$os_version) = @_;
45 201         423 $target->{Woothee::DataSet->const('ATTRIBUTE_OS_VERSION')} = $os_version;
46             }
47              
48             1;
49              
50             __END__