File Coverage

blib/lib/NewsExtractor/SiteSpecificExtractor/www_xinhuanet_com.pm
Criterion Covered Total %
statement 9 13 69.2
branch 0 2 0.0
condition n/a
subroutine 3 4 75.0
pod 0 1 0.0
total 12 20 60.0


line stmt bran cond sub pod time code
1             package NewsExtractor::SiteSpecificExtractor::www_xinhuanet_com;
2 1     1   8 use utf8;
  1         3  
  1         7  
3 1     1   37 use Moo;
  1         3  
  1         5  
4             extends 'NewsExtractor::GenericExtractor';
5              
6 1     1   377 use Importer 'NewsExtractor::TextUtil' => qw(u normalize_whitespace);
  1         3  
  1         9  
7              
8             sub dateline {
9 0     0 0   my ($self) = @_;
10 0 0         my $el = $self->dom->at('.h-info > .h-time') or return;
11              
12 0           my @t = split /[^0-9]+/, normalize_whitespace($el->all_text);
13 0           return u(
14             sprintf(
15             '%04d-%02d-%02dT%02d:%02d:%02d+08:00',
16             $t[0], $t[1], $t[2], $t[3], $t[4], $t[5]
17             )
18             );
19             }
20              
21             1;