File Coverage

blib/lib/NewsExtractor/SiteSpecificExtractor/news_cctv_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::news_cctv_com;
2 1     1   8 use utf8;
  1         2  
  1         8  
3 1     1   33 use Moo;
  1         2  
  1         5  
4             extends 'NewsExtractor::GenericExtractor';
5              
6 1     1   331 use Importer 'NewsExtractor::TextUtil' => qw(u normalize_whitespace);
  1         3  
  1         7  
7              
8             sub dateline {
9 0     0 0   my ($self) = @_;
10 0 0         my $el = $self->dom->at('div.info1') or return;
11 0           my @t = normalize_whitespace($el->all_text) =~ m/([0-9]+)/g;
12 0           return u(
13             sprintf(
14             '%04d-%02d-%02dT%02d:%02d:%02d+08:00',
15             $t[0], $t[1], $t[2], $t[3], $t[4], $t[5]
16             )
17             );
18             }
19              
20             1;