Data/Parser/Table.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 35 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
get_value
2.0
BEGIN
2.0
CRAP 2.0
1 package Feed::Data::Parser::Table;
2  
3 use Moo;
4 extends 'Feed::Data::Parser::Base';
5 use Compiled::Params::OO qw/cpo/;
6 use Types::Standard qw/Object HashRef Str/;
7 use HTML::TableContent;
8  
9 our $validate;
10 BEGIN {
11 $validate = cpo(
12 get_value => [Object, HashRef, Str],
13 );
14 }
15  
16 has '+parser' => (
17 default => sub {
18 my $self = shift;
19 my $content = $self->content_ref;
20 my $t = HTML::TableContent->new();
21 $t->parse($$content);
22 return { items => $t->get_first_table->aoh };
23 },
24 );
25  
26 sub get_value {
27 my ($self, $item, $action) = $validate->get_value->(@_);
28 my $value = $item->{$action};
29 return $value // '';
30 }
31  
32 1; # End of Feed::Data