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             package NewsExtractor::SiteSpecificExtractor::www_digitimes_com_tw;
2 1     1   124 use utf8;
  1         4  
  1         6  
3 1     1   36 use Moo;
  1         4  
  1         19  
4             extends 'NewsExtractor::GenericExtractor';
5              
6 1     1   341 use Importer 'NewsExtractor::TextUtil' => qw(u);
  1         4  
  1         5  
7              
8             sub journalist {
9 0     0 0   my ($self) = @_;
10 0 0         my $el = $self->dom->at('li > time') or return;
11 0           $el = $el->parent->previous->at('span > span');
12 0           return $el->all_text;
13             }
14              
15             sub dateline {
16 0     0 0   my ($self) = @_;
17 0 0         my $el = $self->dom->at('li > time') or return;
18              
19 0           my @t = $el->all_text =~ m/([0-9]+)/g;
20 0           return u(
21             sprintf(
22             '%04d-%02d-%02dT%02d:%02d:%02d+08:00',
23             $t[0], $t[1], $t[2], 23, 59, 59
24             )
25             );
26             }
27              
28             1;