| 1 | package WWW::Crawl4AI::Attempt; | ||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: one strategy attempt in a WWW::Crawl4AI fallback chain | ||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||
| 5 | 6 | our $VERSION = '0.001'; | |||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||
| 8 | 6 | has backend => ( is => 'ro', required => 1 ); | |||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||
| 11 | 0 | ▶ | has cost_class => ( is => 'ro', default => sub { 'cheap' } ); | ||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | has ok => ( is => 'ro', default => sub { 0 } ); | ||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||
| 17 | 6 | has page => ( is => 'ro' ); | |||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||
| 20 | 3 | ▶ | has signals => ( is => 'ro', default => sub { {} } ); | ||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||
| 23 | 6 | has why_failed => ( is => 'ro' ); | |||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||
| 26 | 6 | has error => ( is => 'ro' ); | |||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||
| 29 | 6 | has elapsed => ( is => 'ro' ); | |||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||
| 32 | 5 | ▶ | sub to_hash { | ||||||||||||||||||||||||||||||||||
|
Subroutine
to_hash: called CC=7 SCAR=22.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 33 | 5 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||
| 34 | 5 | ▶ | my $page = $self->page || {}; | ||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->page || {}
MC/DC0%0/1
$self->page || {}
$self->page
Truth table50%1/2
A
A= $self->page
| |||||||||||||||||||||||||||||||||||||
| 35 | return { | ||||||||||||||||||||||||||||||||||||
| 36 | backend => $self->backend, | ||||||||||||||||||||||||||||||||||||
| 37 | cost_class => $self->cost_class, | ||||||||||||||||||||||||||||||||||||
| 38 | ok => $self->ok ? \1 : \0, | ||||||||||||||||||||||||||||||||||||
| 39 | status_code => $page->{status_code}, | ||||||||||||||||||||||||||||||||||||
| 40 | final_url => $page->{final_url} // $page->{url}, | ||||||||||||||||||||||||||||||||||||
| 41 | 5 | ▶ | markdown_len => defined $page->{markdown} ? length $page->{markdown} : 0, | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
$page->{"final_url"} // $page->{"url"}
MC/DC50%1/2
$page->{"final_url"} // $page->{"url"}
$page->{"final_url"}
$page->{"url"}
Truth table66%2/3
A // B
A= $page->{"final_url"}B= $page->{"url"}
| |||||||||||||||||||||||||||||||||||||
| 42 | signals => $self->signals, | ||||||||||||||||||||||||||||||||||||
| 43 | why_failed => $self->why_failed, | ||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | ( defined $self->error ? ( error => "@{[ $self->error ]}" ) : () ), | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 45 | ( defined $self->elapsed ? ( elapsed => $self->elapsed ) : () ), | ||||||||||||||||||||||||||||||||||||
| 46 | }; | ||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub TO_JSON { $_[0]->to_hash } | ||||||||||||||||||||||||||||||||||
|
Subroutine
TO_JSON: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||
| 53 | 6 | 1; | |||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||
| 55 | __END__ | ||||||||||||||||||||||||||||||||||||