blib/lib/Cikl/Smrt/Fetchers/File.pm

filter: Statementstmt 77.7% 28 / 36 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 90.0% 9 / 10 Podpod 0.0% 0 / 2 totaltotal 67.2% 37 / 55 CC 4 SCAR 19.2
CC
4
Cov
67%
fetch
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.8
« blib/lib/Cikl/Util/TimeHelpers.pm ↑ Summary blib/lib/Cikl/Smrt/Broker.pm »
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
BranchTrueFalseTotal
unless (defined $feedurl->scheme) 0 0 0
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
BranchTrueFalseTotal
unless ($feedurl->scheme eq "file") 0 0 0
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)
l!l
00
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)
Aresult
11
00
36
37 0 return $fh;
38 }
39  
40 1 __PACKAGE__->meta->make_immutable;
41  
42 1 1;
« blib/lib/Cikl/Util/TimeHelpers.pm ↑ Summary blib/lib/Cikl/Smrt/Broker.pm »