lib/Ftree/DataParsers/ArrayImporters/CSVArrayImporter.pm

filter: Statementstmt 50.0% 15 / 30 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 4 / 8 Podpod 0.0% 0 / 4 totaltotal 35.8% 19 / 53 CC 5 SCAR 17.0
CC
5
Cov
38%
next
12.0
new
6.0
close
6.0
CRAP 5.5
« lib/Ftree/Name.pm ↑ Summary lib/Ftree/FamilyTreeBase.pm »
1 package Ftree::DataParsers::ArrayImporters::CSVArrayImporter;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use version; our $VERSION = qv('2.3.41');
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Params::Validate qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 # use CGI::Carp qw(fatalsToBrowser);
7 2 my $fh;
8
9 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
10 0 my ($classname, $file_name, $encoding) = @_;
11 0 my $self = {
12 current_line => undef,
13 };
14 0 ▶ open $fh, "<:encoding($encoding)", "$file_name"
Branch: 1 branch
BranchTrueFalseTotal
open $fh, "<:encoding($encoding)", "$file_name" or die("Unable to open datafile $file_name") 0 0 0
15 or die "Unable to open datafile $file_name";
16 0 $self->{current_line} = <$fh>;
17 0 return bless $self, $classname;
18 }
19 0 ▶sub hasNext {
Subroutine hasNext: not called CC=1 SCAR=6.9
Pod undocumented
20 0 my ($self) = validate_pos(@_, {type => HASHREF});
21 0 return $self->{current_line};
22 }
23 0 ▶sub next {
Subroutine next: not called CC=3 SCAR=24.8
Pod undocumented
24 0 my ($self) = validate_pos(@_, {type => HASHREF});
25 0 my $prevline = $self->{current_line};
26 do {
27 0 $self->{current_line} = <$fh>;
28 }
29 0 ▶ while($self->{current_line} && $self->{current_line} =~ m/^\s*\#/x); # skip comments
Branch: 1 branch
BranchTrueFalseTotal
$self->{"current_line"} and $self->{"current_line"} =~ /^\s*\#/x and do { do { $self->{"current_line"} = readline $fh } } 0 0 0
Condition0%0/3
$self->{"current_line"} and $self->{"current_line"} =~ /^\s*\#/x
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"current_line"} and $self->{"current_line"} =~ /^\s*\#/x
$self->{"current_line"} $self->{"current_line"} =~ /^\s*\#/x
Truth table0%0/3
A and B
A= $self->{"current_line"}B= $self->{"current_line"} =~ /^\s*\#/x
ABresult
0X0
100
111
30
31
32 0 chomp($prevline);
33 0 return split( /;/, $prevline);
34 }
35 0 ▶sub close {
Subroutine close: not called CC=2 SCAR=17.9
Pod undocumented
36 0 my ($self) = validate_pos(@_, {type => HASHREF});
37 0 ▶ close($fh) or die "Unable to close datafile";
Branch: 1 branch
BranchTrueFalseTotal
CORE::close $fh or die("Unable to close datafile") 0 0 0
38 }
39
40 2 1;
« lib/Ftree/Name.pm ↑ Summary lib/Ftree/FamilyTreeBase.pm »