| 1 | package Feed::Data::Parser::Text; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | extends 'Feed::Data::Parser::Base'; | |||||||||||
| 5 | 1 | ▶ | use Compiled::Params::OO qw/cpo/; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 1 | ▶ | use Types::Standard qw/Object HashRef Str/; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 1 | our $validate; | |||||||||||
| 8 | BEGIN { | ||||||||||||
| 9 | 1 | ▶ | $validate = cpo( | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | get_value => [Object, HashRef, Str], | ||||||||||||
| 11 | ); | ||||||||||||
| 12 | } | ||||||||||||
| 13 | |||||||||||||
| 14 | has '+parser' => ( | ||||||||||||
| 15 | default => sub { | ||||||||||||
| 16 | 1 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||
| 17 | 1 | my $content = $self->content_ref; | |||||||||||
| 18 | 1 | my (@matches, %match); | |||||||||||
| 19 | 1 | ▶ | while ($$content =~ s/([A-Za-z]+)\s*\:(.*)//) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 20 | 13 | ▶ | if (defined $match{$1}) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 21 | 1 | push @matches, {%match}; | |||||||||||
| 22 | 1 | %match = (); | |||||||||||
| 23 | } | ||||||||||||
| 24 | 13 | $match{$1} = $2; | |||||||||||
| 25 | } | ||||||||||||
| 26 | 1 | push @matches, {%match}; | |||||||||||
| 27 | 1 | return { items => \@matches }; | |||||||||||
| 28 | }, | ||||||||||||
| 29 | 1 | ); | |||||||||||
| 30 | |||||||||||||
| 31 | has '+potential_fields' => ( | ||||||||||||
| 32 | default => sub { | ||||||||||||
| 33 | return { | ||||||||||||
| 34 | 1 | ▶ | title => 'title', | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 35 | description => 'description', | ||||||||||||
| 36 | date => 'date', | ||||||||||||
| 37 | author => 'author', | ||||||||||||
| 38 | category => 'category', | ||||||||||||
| 39 | permalink => 'permalink', | ||||||||||||
| 40 | comment => 'comment', | ||||||||||||
| 41 | link => 'link', | ||||||||||||
| 42 | content => 'content', | ||||||||||||
| 43 | image => 'image', | ||||||||||||
| 44 | }; | ||||||||||||
| 45 | }, | ||||||||||||
| 46 | 1 | ); | |||||||||||
| 47 | |||||||||||||
| 48 | sub get_value { | ||||||||||||
| 49 | 22 | ▶ | my ($self, $item, $action) = $validate->get_value->(@_); | ||||||||||
|
Subroutine
get_value: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 50 | 22 | my $value = $item->{$action}; | |||||||||||
| 51 | 22 | ▶ | return $value // ''; | ||||||||||
|
Condition100%2/2
$value // ""
MC/DC100%1/1
$value // ""
$value
Truth table100%2/2
A
A= $value
| |||||||||||||
| 52 | } | ||||||||||||
| 53 | |||||||||||||
| 54 | 1 | 1; # End of Data::Feed | |||||||||||