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   34 use strict;
  6         8  
  6         133  
4 6     6   26 use warnings;
  6         8  
  6         106  
5 6     6   23 use Carp;
  6         7  
  6         235  
6              
7 6     6   27 use Woothee::DataSet;
  6         8  
  6         445  
8              
9             our $VERSION = "1.8.0";
10              
11             our (@ISA, @EXPORT_OK);
12             BEGIN {
13 6     6   32 require Exporter;
14 6         137 our @ISA = qw(Exporter);
15 6         1581 our @EXPORT_OK = qw(update_map update_category update_version update_os update_os_version);
16             }
17              
18             sub update_map {
19 855     855 0 1160 my ($target,$source) = @_;
20 855         2498 foreach my $key (%$source) {
21 8340 100 100     12347 next if $key eq Woothee::DataSet->const('KEY_LABEL') or $key eq Woothee::DataSet->const('KEY_TYPE');
22 6630 100 100     14734 if (defined($source->{$key}) and length($source->{$key}) > 0) {
23 1920         3448 $target->{$key} = $source->{$key};
24             }
25             }
26             }
27              
28             sub update_category {
29 261     261 0 400 my ($target,$category) = @_;
30 261         442 $target->{Woothee::DataSet->const('ATTRIBUTE_CATEGORY')} = $category;
31             }
32              
33             sub update_version {
34 381     381 0 649 my ($target,$version) = @_;
35 381         663 $target->{Woothee::DataSet->const('ATTRIBUTE_VERSION')} = $version;
36             }
37              
38             sub update_os {
39 261     261 0 408 my ($target,$os) = @_;
40 261         452 $target->{Woothee::DataSet->const('ATTRIBUTE_OS')} = $os;
41             }
42              
43             sub update_os_version {
44 204     204 0 313 my ($target,$os_version) = @_;
45 204         345 $target->{Woothee::DataSet->const('ATTRIBUTE_OS_VERSION')} = $os_version;
46             }
47              
48             1;
49              
50             __END__