File Coverage

blib/lib/NewsExtractor/SiteSpecificExtractor/www_digitimes_com_tw.pm
Criterion Covered Total %
statement 9 17 52.9
branch 0 4 0.0
condition n/a
subroutine 3 5 60.0
pod 0 2 0.0
total 12 28 42.8


line stmt bran cond sub pod time code
1             use utf8;
2 1     1   98 use Moo;
  1         4  
  1         5  
3 1     1   27 extends 'NewsExtractor::GenericExtractor';
  1         2  
  1         4  
4              
5             use Importer 'NewsExtractor::TextUtil' => qw(u);
6 1     1   282  
  1         2  
  1         6  
7             my ($self) = @_;
8             my $el = $self->dom->at('li > time') or return;
9 0     0 0   $el = $el->parent->previous->at('span > span');
10 0 0         return $el->all_text;
11 0           }
12 0            
13             my ($self) = @_;
14             my $el = $self->dom->at('li > time') or return;
15              
16 0     0 0   my @t = $el->all_text =~ m/([0-9]+)/g;
17 0 0         return u(
18             sprintf(
19 0           '%04d-%02d-%02dT%02d:%02d:%02d+08:00',
20 0           $t[0], $t[1], $t[2], 23, 59, 59
21             )
22             );
23             }
24              
25             1;