VE/Exception.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 2 / 2 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 8 / 8 Podpod 100% 5 / 5 totaltotal 84.3% 43 / 51 CC 4 SCAR 5.6
CC
4
Cov
88%
throw
3.0
_new
2.1
BEGIN
1.0
CRAP 1.8
« VE/Cluster.pm ↑ Summary
1 #!/bin/false
2 # vim: softtabstop=4 tabstop=4 shiftwidth=4 ft=perl expandtab smarttab
3 # PODNAME: Net::Proxmox::VE::Exception
4 # ABSTRACT: Functions for the 'cluster' portion of the API
5  
6 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 package Net::Proxmox::VE::Exception;
10 8 $Net::Proxmox::VE::Exception::VERSION = '0.44';
11  
12 7 ▶sub _new {
Subroutine _new: called CC=2 SCAR=7.4
13  
14 7 my ($c, %args) = @_;
15 7 ▶ my $class = ref($c) || $c;
Condition33%1/3
ref $c || $c
l!l&&r!l&&!r
070
MC/DC0%0/2
ref $c || $c
ref $c $c
Truth table33%1/3
A || B
A= ref $cB= $c
ABresult
1X1
011
000
16 7 my $self = \%args;
17  
18 7 return bless $self, $class;
19  
20 }
21  
22  
23 1 ▶sub as_string {
Subroutine as_string: called CC=1 SCAR=0.0
Pod documented
24 1 my $self = shift;
25 1 sprintf '%s at %s line %s.', $self->message, $self->file, $self->line;
26 }
27  
28  
29 5 ▶sub file { return shift->{file} }
Subroutine file: called CC=1 SCAR=0.0
Pod documented
30  
31  
32 5 ▶sub line { return shift->{line} }
Subroutine line: called CC=1 SCAR=0.0
Pod documented
33  
34  
35 5 ▶sub message { return shift->{message} }
Subroutine message: called CC=1 SCAR=0.0
Pod documented
36  
37  
38 4 ▶sub throw {
Subroutine throw: called CC=3 SCAR=11.1
Pod documented
39  
40 4 my ($class, $arg) = @_;
41 4 ▶ $class = ref $class || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
040
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
42  
43 4 my %args;
44 4 ▶ if ( ref $arg ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $arg) { } 2 2 4
45 2 %args = %$arg;
46 }
47 else {
48 2 $args{message} = $arg;
49 }
50  
51 4 ( $args{package}, $args{file}, $args{line} ) = caller(0);
52 4 $args{subroutine} = ( caller(1) )[3];
53  
54 4 die $class->_new(%args);
55  
56 }
57  
58  
59 8 1;
60  
61 __END__
« VE/Cluster.pm ↑ Summary