File Coverage

blib/lib/NewsExtractor/SiteSpecificExtractor/ETtoday.pm
Criterion Covered Total %
statement 6 14 42.8
branch 0 2 0.0
condition n/a
subroutine 2 3 66.6
pod 0 1 0.0
total 8 20 40.0


line stmt bran cond sub pod time code
1             package NewsExtractor::SiteSpecificExtractor::ETtoday;
2 1     1   8 use utf8;
  1         2  
  1         7  
3 1     1   36 use Moo;
  1         4  
  1         6  
4             extends 'NewsExtractor::GenericExtractor';
5              
6             sub journalist {
7 0     0 0   my ($self) = @_;
8 0           my $text = $self->content_text;
9 0           my @patterns = (
10             qr{(?:\n|\A)(?:實習)? 記者 ([\p{Letter}、]+?) / (?:[\p{Letter}—]+)? (?:報導|編譯) \n}x,
11             qr{(?:\n|\A)網搜小組/([\p{Letter}、]+)報導\n},
12             qr{\b((?:圖、)?文/[\p{Letter}\p{Digit}]+)\n},
13             );
14              
15 0           my $name;
16 0           for my $pat (@patterns) {
17 0           ($name) = $text =~ $pat;
18 0 0         last if $name;
19             }
20 0           return $name;
21             }
22              
23             1;