File Coverage

blib/lib/NewsExtractor/SiteSpecificExtractor/www_hkcnews_com.pm
Criterion Covered Total %
statement 6 15 40.0
branch 0 2 0.0
condition 0 6 0.0
subroutine 2 4 50.0
pod 0 2 0.0
total 8 29 27.5


line stmt bran cond sub pod time code
1             use utf8;
2 1     1   6 use Moo;
  1         2  
  1         5  
3 1     1   25 extends 'NewsExtractor::GenericExtractor';
  1         3  
  1         4  
4              
5             around headline => sub {
6             my $orig = shift;
7             my $self = $_[0];
8             my $headline = $orig->(@_);
9             my $journalist = $self->journalist();
10             $headline =~ s/\s\|\s${journalist}$//;
11             return $headline;
12             };
13              
14             my ($self) = @_;
15             my $el = $self->dom->at('.article-info');
16 0     0 0   my ($n) = $el->all_text =~ m{^(?:Author|撰文): (?:(?:特約)?記者)?(.+?) \|};
17 0           return $n;
18 0           }
19 0            
20             my ($self) = @_;
21             my $el = $self->dom->at('.article-info');
22             my ($dd,$mm,$yy) = $el->all_text =~ m{(?:發佈日期|Publish Date):\s([0-9]{2})\.([0-9]{2})\.([0-9]{2})\b};
23 0     0 0   return undef unless ($dd && $mm && $yy);
24 0           return "20${yy}-${mm}-${dd}T23:59:59+08:00";
25 0           }
26 0 0 0        
      0        
27 0            
28             1;