| 1 | package Cikl::Smrt::Fetchers::File; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | ▶ | use URI::file; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 1 | ▶ | use Mouse; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 1 | ▶ | use IO::File; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 1 | ▶ | use Cikl::Smrt::Fetcher; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 1 | extends 'Cikl::Smrt::Fetcher'; | |||||||||||
| 10 | |||||||||||||
| 11 | 1 | ▶ | use namespace::autoclean; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | |||||||||||||
| 13 | 1 | ▶ | use constant SCHEMES => ( | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | 'file', | ||||||||||||
| 15 | '__undef__'# this tells us that it's a relative path. | ||||||||||||
| 16 | 1 | ); | |||||||||||
| 17 | |||||||||||||
| 18 | 4 | ▶ | sub schemes { | ||||||||||
|
Subroutine
schemes: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 19 | 4 | return SCHEMES; | |||||||||||
| 20 | } | ||||||||||||
| 21 | |||||||||||||
| 22 | 0 | ▶ | sub fetch { | ||||||||||
|
Subroutine
fetch: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||
| 23 | 0 | my $self = shift; | |||||||||||
| 24 | 0 | my $feedurl = $self->feedurl(); | |||||||||||
| 25 | |||||||||||||
| 26 | 0 | ▶ | if (!defined($feedurl->scheme())) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 27 | # it's going to be a relative URL. | ||||||||||||
| 28 | 0 | $feedurl = URI::file->new_abs($feedurl->as_string()); | |||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 0 | ▶ | unless ($feedurl->scheme() eq 'file') { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 32 | 0 | die("Unsupported URI scheme: " . $feedurl->scheme); | |||||||||||
| 33 | } | ||||||||||||
| 34 | |||||||||||||
| 35 | 0 | ▶ | my $fh = IO::File->new("< " . $feedurl->path) || die($!.': '.$feedurl->path); | ||||||||||
|
Condition0%0/2
'IO::File'->new('< ' . $feedurl->path) || die($! . ': ' . $feedurl->path)
MC/DC0%0/1
'IO::File'->new('< ' . $feedurl->path) || die($! . ': ' . $feedurl->path)
'IO::File'->new('< ' . $feedurl->path)
Truth table0%0/2
A
A= 'IO::File'->new('< ' . $feedurl->path)
| |||||||||||||
| 36 | |||||||||||||
| 37 | 0 | return $fh; | |||||||||||
| 38 | } | ||||||||||||
| 39 | |||||||||||||
| 40 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||
| 41 | |||||||||||||
| 42 | 1 | 1; | |||||||||||