NewsExtractor/SiteSpecificExtractor/newtalk_tw.pm

filter: Statementstmt 61.1% 11 / 18 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 51.8% 14 / 27 CC 3 SCAR 18.7
CC
3
Cov
50%
dateline
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.5
« NewsExtractor/SiteSpecificExtractor/UDN.pm ↑ Summary NewsExtractor/SiteSpecificExtractor/news_ttv_com_tw.pm »
1 package NewsExtractor::SiteSpecificExtractor::newtalk_tw;
2 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 extends 'NewsExtractor::GenericExtractor';
5  
6 1 ▶use Importer 'NewsExtractor::TextUtil' => 'u';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub dateline {
Subroutine dateline: not called CC=3 SCAR=24.8
Pod undocumented
9 0 my ($self) = @_;
10 0 my ($el, $dateline);
11 0 ▶ if ($el = $self->dom->at('meta[property="article:published_time"]')) {
Branch: 2 branches
BranchTrueFalseTotal
if ($el = $self->dom->at('meta[property="article:published_time"]')) { } 0 0 0
elsif ($el = $self->dom->at('div.contentBox div.content_date')) { } 0 0 0
12 0 $dateline = $el->attr('content');
13 } elsif ($el = $self->dom->at('div.contentBox div.content_date')) {
14 0 my @t = $el->all_text =~ m/([0-9]+)/g;
15 0 $dateline = u(sprintf('%04d-%02d-%02dT%02d:%02d:%02d+08:00',
16 $t[0], $t[1], $t[2], $t[3], $t[4], 59));
17 }
18 0 return $dateline;
19 }
20  
21 1 1;
« NewsExtractor/SiteSpecificExtractor/UDN.pm ↑ Summary NewsExtractor/SiteSpecificExtractor/news_ttv_com_tw.pm »