blib/lib/NewsExtractor/SiteSpecificExtractor/turnnewsapp_com.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 | use utf8; | ||||||
2 | 1 | 1 | 6 | use Moo; | |||
1 | 2 | ||||||
1 | 5 | ||||||
3 | 1 | 1 | 26 | extends 'NewsExtractor::GenericExtractor'; | |||
1 | 2 | ||||||
1 | 5 | ||||||
4 | |||||||
5 | my ($self) = @_; | ||||||
6 | my $text = $self->content_text; | ||||||
7 | 0 | 0 | 0 | my @patterns = ( | |||
8 | 0 | qr{(記者/?(\p{Letter}+))\z}, | |||||
9 | 0 | qr{\n((中國時報/.+))(?:\n|\z)}, | |||||
10 | qr{((記者/.+?))\z}, | ||||||
11 | qr{((特派員.+?))\z}, | ||||||
12 | ); | ||||||
13 | |||||||
14 | my $name; | ||||||
15 | for my $pat (@patterns) { | ||||||
16 | 0 | ($name) = $text =~ $pat; | |||||
17 | 0 | last if $name; | |||||
18 | 0 | } | |||||
19 | 0 | 0 | return $name; | ||||
20 | } | ||||||
21 | 0 | ||||||
22 | 1; |