NewsExtractor/SiteSpecificExtractor/www_twreporter_org.pm

filter: Statementstmt 55.0% 11 / 20 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 2 totaltotal 45.1% 14 / 31 CC 3 SCAR 17.7
CC
3
Cov
46%
dateline
12.0
journalist
2.0
BEGIN
1.0
CRAP 5.9
« NewsExtractor/SiteSpecificExtractor/news_ttv_com_tw.pm ↑ Summary NewsExtractor/SiteSpecificExtractor/news_pts_org_tw.pm »
1 package NewsExtractor::SiteSpecificExtractor::www_twreporter_org;
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 = $self->dom->at('meta[itemprop=dateModified][content]') or return;
Branch: 1 branch
BranchTrueFalseTotal
my $el = $self->dom->at("meta[itemprop=dateModified][content]") or return 0 0 0
11  
12 0 my $dateline;
13 0 ▶ if (my ($y,$m,$d) = $el->attr('content') =~ m/([0-9]{4})\.([0-9]{1,2})\.([0-9]{1,2})/) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = $el->attr("content") =~ /([0-9]{4})\.([0-9]{1,2})\.([0-9]{1,2})/) 0 0 0
14 0 $dateline = u(sprintf('%04d-%02d-%02d', $1, $2, $3));
15 }
16  
17 0 return $dateline;
18 }
19  
20 0 ▶sub journalist {
Subroutine journalist: not called CC=1 SCAR=6.9
Pod undocumented
21 0 my ($self) = @_;
22 0 my $txt = $self->dom->find('span[class^="metadata__AuthorName"]')->map('all_text')->uniq()->join('、');
23 0 return u($txt);
24 }
25  
26 1 1;
« NewsExtractor/SiteSpecificExtractor/news_ttv_com_tw.pm ↑ Summary NewsExtractor/SiteSpecificExtractor/news_pts_org_tw.pm »