blib/lib/SPVM/ExchangeAPI/Error.pm

filter: Statementstmt 56.0% 14 / 25 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 66.6% 4 / 6 Podpod 100% 4 / 4 totaltotal 44.9% 22 / 49 CC 5 SCAR 11.7
CC
5
Cov
40%
id
4.5
id
4.5
new
3.1
CRAP 3.2
« blib/lib/SPVM/ExchangeAPI/Class.pm ↑ Summary blib/lib/SPVM/Builder/ScriptInfo.pm »
1 package SPVM::ExchangeAPI::Error;
2 345 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 345 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # Fields
6 419 ▶sub id {
Subroutine id: called CC=2 SCAR=15.1
Pod documented
7 0 ▶ my $self = shift;
Subroutine id: not called CC=2 SCAR=15.1
Pod documented
8 0 ▶ if (@_) {
Branch: 2 branches
BranchTrueFalseTotal
if (@_) { } 0 0 0
if (@_) { } 0 0 0
9 0 $self->{id} = $_[0];
10 0 return $self;
11 }
12 else {
13 0 return $self->{id};
14 }
15 }
16  
17 # Class Methods
18 419 ▶sub new {
Subroutine new: called CC=2 SCAR=11.2
Pod documented
19 0 ▶ my $error = shift;
Subroutine new: not called CC=2 SCAR=11.2
Pod documented
20
21 0 my $self = {
22 id => 0,
23 @_
24 };
25
26 0 ▶ bless $self, ref $error || $error;
Condition0%0/6
ref $error || $error
l!l&&r!l&&!r
000
ref $error || $error
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $error || $error
ref $error $error
MC/DC0%0/2
ref $error || $error
ref $error $error
Truth table0%0/3
A || B
A= ref $errorB= $error
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= ref $errorB= $error
ABresult
1X1
011
000
27
28 419 return $self;
29 }
30  
31 345 1;
32  
33 =head1 Name
34  
35 SPVM::ExchangeAPI::Error - Error Code
36  
37 =head1 Description
38  
39 The SPVM::ExchangeAPI::Error class has methods to get and set an error id.
40  
41 =head1 Usage
42
43 my $error = SPVM::ExchangeAPI::Error->new;
44 $error->id(2);
45 my $die_error_id = $error->id;
46  
47 =head1 Fields
48  
49 =head2 id
50  
51 my $id = $error->id;
52 $error->id($id);
53  
54 Gets and sets an error id.
55  
56 Examples:
57  
58 $error->id(2);
59 my $id = $error->id;
60  
61 =head1 Class Methods
62  
63 =head2 new
64  
65 my $error = SPVM::ExchangeAPI::Error->new(%options);
66  
67 Creates a new C<SPVM::ExchangeAPI::Error> object.
68  
69 Options:
70  
71 =over 2
72  
73 =item * C<id>
74  
75 An error id.
76  
77 =back
78  
79 =head1 Copyright & License
80  
81 Copyright (c) 2023 Yuki Kimoto
82  
83 MIT License
« blib/lib/SPVM/ExchangeAPI/Class.pm ↑ Summary blib/lib/SPVM/Builder/ScriptInfo.pm »