Iter/File.pm

filter: Statementstmt 80.9% 34 / 42 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 91.6% 11 / 12 Podpod n/a totaltotal 72.5% 45 / 62 CC 6 SCAR 27.4
CC
6
Cov
68%
_retrieve_attrs
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 15.5
↑ Summary Iter/Dir.pm »
1 package Net::FTP::Path::Iter::File;
2  
3 # ABSTRACT: Class representing a File
4  
5 4 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 4 our $VERSION = '0.07';
10  
11 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 4 ▶use File::Spec::Functions qw[ catfile ];
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 4 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 4 ▶use parent 'Net::FTP::Path::Iter::Entry';
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 4 ▶use constant is_file => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 4 ▶use constant is_dir => 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 # if an entity doesn't have attributes, it didn't get loaded
26 # from a directory listing. Try to get one.
27 0 ▶sub _retrieve_attrs {
Subroutine _retrieve_attrs: not called CC=6 SCAR=37.4
28  
29 0 my $self = shift;
30 0 ▶ return if $self->_has_attrs;
Branch: 1 branch
BranchTrueFalseTotal
if $self->_has_attrs 0 0 0
31  
32 0 my ( $entry ) = my @entries = grep $self->name eq $_->{name}, $self->get_entries( $self->parent );
33  
34 0 ▶ croak( 'multiple ftp entries for ', $self->path )
Branch: 1 branch
BranchTrueFalseTotal
if @entries > 1 0 0 0
35 if @entries > 1;
36  
37 0 ▶ croak( 'unable to find attributes for ', $self->path )
Branch: 1 branch
BranchTrueFalseTotal
if @entries == 0 0 0 0
38 if @entries == 0;
39  
40 croak( $self->{path}, ': expected file, got ', $entry->{type} )
41 0 ▶ unless $entry->{type} eq 'f';
Branch: 1 branch
BranchTrueFalseTotal
unless $entry->{"type"} eq "f" 0 0 0
42  
43 0 $self->$_( $entry->{$_} ) for keys %$entry;
44  
45 0 return;
46 }
47  
48 #
49 # This file is part of Net-FTP-Path-Iter
50 #
51 # This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory.
52 #
53 # This is free software, licensed under:
54 #
55 # The GNU General Public License, Version 3, June 2007
56 #
57  
58 4 1;
59  
60 __END__
↑ Summary Iter/Dir.pm »