Object/Svr4.pm

filter: Statementstmt 46.3% 19 / 41 Branchbran 21.4% 3 / 14 Conditioncond 17.6% 3 / 17 MC/DCmcdc 0.0% 0 / 11 Subroutinesub 40.0% 4 / 10 Podpod 33.3% 2 / 6 totaltotal 31.3% 31 / 99 CC 14 SCAR 27.5
CC
14
Cov
35%
_check_data
27.8
user
12.0
group
12.0
CRAP 15.7
↑ Summary Svr4.pm »
1 package Software::Packager::Object::Svr4;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use base qw(Software::Packager::Object);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 $VERSION = 0.02;
7  
8 16 ▶sub _check_data {
Subroutine _check_data: called CC=10 SCAR=33.2
9 16 my ($self, %data) = @_;
10  
11 16 $self->{TYPE} = lc $self->{TYPE};
12 16 ▶ if ($self->{TYPE} eq 'file') {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'TYPE'} eq 'file') { } 0 16 16
elsif ($self->{'TYPE'} eq 'hardlink' or $self->{'TYPE'} eq 'softlink') { } 0 16 16
13 0 ▶ return undef unless -f $self->{SOURCE};
Branch: 1 branch
BranchTrueFalseTotal
unless -f $self->{"SOURCE"} 0 0 0
14 ▶ } elsif ($self->{TYPE} eq 'hardlink' ||
Condition33%1/3
$self->{"TYPE"} eq "hardlink" or $self->{"TYPE"} eq "softlink"
l!l&&r!l&&!r
0016
MC/DC0%0/2
$self->{"TYPE"} eq "hardlink" or $self->{"TYPE"} eq "softlink"
$self->{"TYPE"} eq "hardlink" $self->{"TYPE"} eq "softlink"
Truth table33%1/3
A or B
A= $self->{"TYPE"} eq "hardlink"B= $self->{"TYPE"} eq "softlink"
ABresult
1X1
011
000
15 $self->{TYPE} eq 'softlink') {
16 return undef unless $self->{SOURCE}
17 0 ▶ and $self->{DESTINATION};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"SOURCE"} and $self->{"DESTINATION"} 0 0 0
Condition0%0/3
$self->{"SOURCE"} and $self->{"DESTINATION"}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"SOURCE"} and $self->{"DESTINATION"}
$self->{"SOURCE"} $self->{"DESTINATION"}
Truth table0%0/3
A and B
A= $self->{"SOURCE"}B= $self->{"DESTINATION"}
ABresult
0X0
100
111
18 }
19  
20 16 ▶ $self->{MODE} ||= [stat($self->{SOURCE})]->[2] % 010000;
Condition33%1/3
$self->{"MODE"} ||= [stat $self->{"SOURCE"}]->[2] % 4096
l!l&&r!l&&!r
0016
MC/DC0%0/2
$self->{"MODE"} ||= [stat $self->{"SOURCE"}]->[2] % 4096
$self->{"MODE"} [stat $self->{"SOURCE"}]->[2] % 4096
Truth table33%1/3
A ||= B
A= $self->{"MODE"}B= [stat $self->{"SOURCE"}]->[2] % 4096
ABresult
1X1
011
000
21  
22 # make sure PART is set to a number
23 16 ▶ if (scalar $self->{PART}) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar $self->{'PART'}) { } 0 16 16
24 0 $self->{PART} =~ /\d+/;
25 } else {
26 16 $self->{PART} = 1;
27 }
28  
29 16 ▶ $self->{CLASS} ||= "none";
Condition50%1/2
$self->{"CLASS"} ||= "none"
l!l
016
MC/DC0%0/1
$self->{"CLASS"} ||= "none"
$self->{"CLASS"}
Truth table50%1/2
A
A= $self->{"CLASS"}
Aresult
11
00
30  
31 16 return 1;
32 }
33  
34 0 ▶sub user {
Subroutine user: not called CC=3 SCAR=24.8
Pod documented
35 0 my $self = shift;
36 0 my $value = shift;
37  
38 0 ▶ $self->{USER} = $value
Branch: 1 branch
BranchTrueFalseTotal
if $value 0 0 0
39 if $value;
40 0 ▶ $self->{USER} ||= [getpwuid([lstat($self->source)]->[4])]->[0];
Condition0%0/3
$self->{"USER"} ||= [getpwuid [lstat $self->source]->[4]]->[0]
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"USER"} ||= [getpwuid [lstat $self->source]->[4]]->[0]
$self->{"USER"} [getpwuid [lstat $self->source]->[4]]->[0]
Truth table0%0/3
A ||= B
A= $self->{"USER"}B= [getpwuid [lstat $self->source]->[4]]->[0]
ABresult
1X1
011
000
41 0 return $self->{USER};
42 }
43  
44 sub group
45 0 ▶{
Subroutine group: not called CC=3 SCAR=24.8
Pod documented
46 0 my $self = shift;
47 0 my $value = shift;
48  
49 0 ▶ $self->{GROUP} = $value
Branch: 1 branch
BranchTrueFalseTotal
if $value 0 0 0
50 if $value;
51 0 ▶ $self->{GROUP} ||= [getgrgid([lstat($self->source)]->[5])]->[0];
Condition0%0/3
$self->{"GROUP"} ||= [getgrgid [lstat $self->source]->[5]]->[0]
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"GROUP"} ||= [getgrgid [lstat $self->source]->[5]]->[0]
$self->{"GROUP"} [getgrgid [lstat $self->source]->[5]]->[0]
Truth table0%0/3
A ||= B
A= $self->{"GROUP"}B= [getgrgid [lstat $self->source]->[5]]->[0]
ABresult
1X1
011
000
52 0 return $self->{GROUP};
53 }
54  
55  
56 ################################################################################
57 # Function: status()
58 # Description: This function returns the status for this object.
59 # Arguments: none.
60 # Return: package directory.
61 #
62 0 ▶sub status {
Subroutine status: not called CC=1 SCAR=6.9
Pod undocumented
63 0 my $self = shift;
64 0 return $self->{STATUS};
65 }
66  
67 ################################################################################
68 # Function: class()
69 # Description: This function returns the class for this object.
70 # Arguments: none.
71 # Return: object class
72 #
73 0 ▶sub class {
Subroutine class: not called CC=1 SCAR=6.9
Pod undocumented
74 0 my $self = shift;
75 0 return $self->{CLASS};
76 }
77  
78 ################################################################################
79 # Function: part()
80 # Description: This function returns the part for this object.
81 # Arguments: none.
82 # Return: object part
83 #
84 0 ▶sub part {
Subroutine part: not called CC=1 SCAR=6.9
Pod undocumented
85 0 my $self = shift;
86 0 return $self->{PART};
87 }
88  
89 ################################################################################
90 # Function: prototype()
91 # Description: This function returns the object type for the object as
92 # described in prototype(4) man page.
93 # Arguments: $self
94 # Return: object type
95 #
96 sub prototype
97 0 ▶{
Subroutine prototype: not called CC=1 SCAR=6.9
Pod undocumented
98 0 my $self = shift;
99 0 my %proto_types = (
100 'block' => 'b',
101 'charater' => 'c',
102 'directory' => 'd',
103 'edit' => 'e',
104 'file' => 'f',
105 'installation' => 'i',
106 'hardlink' => 'l',
107 'pipe' => 'p',
108 'softlink' => 's',
109 'volatile' => 'v',
110 'exclusive' => 'x',
111 );
112  
113 0 return $proto_types{$self->{'TYPE'}};
114 }
115  
116 1 1; __END__
↑ Summary Svr4.pm »