| 1 | package SPVM::ExchangeAPI::Error; | ||||||||||||||||||||||||||||||||||||||
| 2 | 531 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 3 | 531 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||
| 5 | # Fields | ||||||||||||||||||||||||||||||||||||||
| 6 | 245 | ▶ | 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
| |||||||||||||||||||||||||||||||||||||||
| 9 | 0 | $self->{id} = $_[0]; | |||||||||||||||||||||||||||||||||||||
| 10 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||
| 11 | } | ||||||||||||||||||||||||||||||||||||||
| 12 | else { | ||||||||||||||||||||||||||||||||||||||
| 13 | 0 | return $self->{id}; | |||||||||||||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||
| 17 | # Class Methods | ||||||||||||||||||||||||||||||||||||||
| 18 | 245 | ▶ | 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
ref $error || $error
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
Truth table0%0/3
A || B
A= ref $errorB= $error
| |||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||
| 28 | 245 | return $self; | |||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||
| 31 | 531 | 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 | ||||||||||||||||||||||||||||||||||||||