NewsExtractor/SiteSpecificExtractor/www_mdnkids_com.pm

filter: Statementstmt 37.9% 11 / 29 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 2 totaltotal 31.8% 14 / 44 CC 6 SCAR 28.0
CC
6
Cov
30%
journalist
30.0
dateline
6.0
BEGIN
1.0
CRAP 16.5
« NewsExtractor/TXExtractor.pm ↑ Summary NewsExtractor/SiteSpecificExtractor/newnet_tw.pm »
1 package NewsExtractor::SiteSpecificExtractor::www_mdnkids_com;
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' => qw(reformat_dateline normalize_whitespace);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub dateline {
Subroutine dateline: not called CC=2 SCAR=17.9
Pod undocumented
9 0 my ($self) = @_;
10 0 my $el = $self->dom->at('h2 ~ div.col span');
11 0 ▶ if ($el) {
Branch: 1 branch
BranchTrueFalseTotal
if ($el) 0 0 0
12 0 my ($ymd) = $el->all_text() =~ m<\(([0-9]{4}/[0-9]{1,2}/[0-9]{1,2})\)\z>;
13 0 return reformat_dateline( $ymd, '+08:00' );
14 }
15 0 return undef;
16 }
17  
18 0 ▶sub journalist {
Subroutine journalist: not called CC=5 SCAR=34.0
Pod undocumented
19 0 my ($self) = @_;
20 0 my ($x, $el);
21 0 ▶ if ($el = $self->dom->at('h2 ~ div.col span')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($el = $self->dom->at("h2 ~ div.col span")) 0 0 0
22 0 $x = $el->all_text() =~ s<\([0-9]{4}/[0-9]{1,2}/[0-9]{1,2}\)\z><>r;
23 0 $x = normalize_whitespace($x);
24 }
25 0 ▶ unless ($x) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($x) 0 0 0
26 0 my $t = $self->content_text;
27  
28 0 my @regexps = (
29 qr{\A(\S+)/\S+報導\n},
30 qr{\A\S*(報導/\S+\s+攝影/\S+)\n},
31 qr{\A\S*(文/\S+\s+圖/\S+)\n},
32 qr{\A\S*(\S{3})\n},
33 );
34  
35 0 for my $re (@regexps) {
36 0 ($x) = $t =~ /$re/;
37 0 ▶ last if $x;
Branch: 1 branch
BranchTrueFalseTotal
if $x 0 0 0
38 }
39 }
40  
41 0 return $x;
42 }
43  
44 1 1;
« NewsExtractor/TXExtractor.pm ↑ Summary NewsExtractor/SiteSpecificExtractor/newnet_tw.pm »