blib/lib/CPAN/FTP/netrc.pm

filter: Statementstmt 8.4% 5 / 59 Branchbran 0.0% 0 / 30 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 14.2% 1 / 7 Podpod 0.0% 0 / 6 totaltotal 5.5% 6 / 108 CC 21 SCAR 41.1
CC
21
Cov
5%
new
90.0
new
90.0
contains
12.0
CRAP 60.7
« blib/lib/CPAN/InfoObj.pm ↑ Summary blib/lib/CPAN/Queue.pm »
1 package CPAN::FTP::netrc;
2 26 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 26 $CPAN::FTP::netrc::VERSION = $CPAN::FTP::netrc::VERSION = "1.01";
5  
6 # package CPAN::FTP::netrc;
7 0 ▶sub new {
Subroutine new: not called CC=9 SCAR=45.0
Pod undocumented
8 0 ▶ my($class) = @_;
Subroutine new: not called CC=9 SCAR=45.0
Pod undocumented
9 0 my $file = File::Spec->catfile($ENV{HOME},".netrc");
10  
11 0 my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
12 $atime,$mtime,$ctime,$blksize,$blocks)
13 = stat($file);
14 0 ▶ $mode ||= 0;
Condition0%0/4
$mode ||= 0
l!l
00
$mode ||= 0
l!l
00
MC/DC0%0/1
$mode ||= 0
$mode
MC/DC0%0/1
$mode ||= 0
$mode
Truth table0%0/2
A
A= $mode
Aresult
11
00
Truth table0%0/2
A
A= $mode
Aresult
11
00
15 0 my $protected = 0;
16  
17 0 my($fh,@machines,$hasdefault);
18 0 $hasdefault = 0;
19 0 ▶ $fh = FileHandle->new or die "Could not create a filehandle";
Branch: 2 branches
BranchTrueFalseTotal
$fh = "FileHandle"->new or die "Could not create a filehandle" 0 0 0
$fh = "FileHandle"->new or die "Could not create a filehandle" 0 0 0
20  
21 0 ▶ if($fh->open($file)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($fh->open($file)) { } 0 0 0
if ($fh->open($file)) { } 0 0 0
22 0 $protected = ($mode & 077) == 0;
23 0 local($/) = "";
24 0 ▶ NETRC: while (<$fh>) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 0 0 0
if (defined($_ = readline $fh)) 0 0 0
25 0 my(@tokens) = split " ", $_;
26 0 ▶ TOKEN: while (@tokens) {
Branch: 2 branches
BranchTrueFalseTotal
if (@tokens) 0 0 0
if (@tokens) 0 0 0
27 0 my($t) = shift @tokens;
28 0 ▶ if ($t eq "default") {
Branch: 2 branches
BranchTrueFalseTotal
if ($t eq "default") 0 0 0
if ($t eq "default") 0 0 0
29 0 $hasdefault++;
30 0 last NETRC;
31 }
32 0 ▶ last TOKEN if $t eq "macdef";
Branch: 2 branches
BranchTrueFalseTotal
if $t eq "macdef" 0 0 0
if $t eq "macdef" 0 0 0
33 0 ▶ if ($t eq "machine") {
Branch: 2 branches
BranchTrueFalseTotal
if ($t eq "machine") 0 0 0
if ($t eq "machine") 0 0 0
34 0 push @machines, shift @tokens;
35 }
36 }
37 }
38 } else {
39 0 $file = $hasdefault = $protected = "";
40 }
41  
42 0 bless {
43 'mach' => [@machines],
44 'netrc' => $file,
45 'hasdefault' => $hasdefault,
46 'protected' => $protected,
47 }, $class;
48 }
49  
50 # CPAN::FTP::netrc::hasdefault;
51 0 ▶sub hasdefault { shift->{'hasdefault'} }
Subroutine hasdefault: not called CC=1 SCAR=6.9
Pod undocumented
52 0 ▶sub netrc { shift->{'netrc'} }
Subroutine netrc: not called CC=1 SCAR=6.9
Pod undocumented
53 0 ▶sub protected { shift->{'protected'} }
Subroutine protected: not called CC=1 SCAR=6.9
Pod undocumented
54 0 ▶sub contains {
Subroutine contains: not called CC=3 SCAR=24.8
Pod undocumented
55 0 my($self,$mach) = @_;
56 0 for ( @{$self->{'mach'}} ) {
57 0 ▶ return 1 if $_ eq $mach;
Branch: 1 branch
BranchTrueFalseTotal
if $_ eq $mach 0 0 0
58 }
59 0 return 0;
60 }
61  
62 26 1;
« blib/lib/CPAN/InfoObj.pm ↑ Summary blib/lib/CPAN/Queue.pm »