File Coverage

blib/lib/NewsExtractor/SiteSpecificExtractor/www_hkcna_hk.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_hkcna_hk;
2 1     1   7 use utf8;
  1         4  
  1         6  
3 1     1   34 use Moo;
  1         3  
  1         5  
4             extends 'NewsExtractor::GenericExtractor';
5              
6 1     1   315 use Importer 'NewsExtractor::TextUtil' => qw(u normalize_whitespace);
  1         2  
  1         6  
7              
8             sub dateline {
9 0     0 0   my ($self) = @_;
10 0 0         my $el = $self->dom->at('div#time p:nth-child(1)') or return;
11 0           $el->find('strong')->map('remove');
12 0           my @t = normalize_whitespace($el->all_text) =~ m/([0-9]+)/g;
13 0           return u( sprintf('%04d-%02d-%02dT%02d:%02d:%02d+08:00', $t[0], $t[1], $t[2], $t[3], $t[4], 59) );
14             }
15              
16             sub journalist {
17 0     0 0   my ($self) = @_;
18 0 0         my $el = $self->dom->at('div.content div.fdr') or return;
19 0           return normalize_whitespace($el->all_text);
20             }
21              
22             1;