File Coverage

blib/lib/SPVM/ExchangeAPI/Error.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 2 100.0
condition 1 3 33.3
subroutine 4 4 100.0
pod 2 2 100.0
total 24 26 92.3


line stmt bran cond sub pod time code
1             package SPVM::ExchangeAPI::Error;
2 278     278   1880 use strict;
  278         565  
  278         9894  
3 278     278   1406 use warnings;
  278         583  
  278         36145  
4              
5             # Fields
6             sub id {
7 14     14 1 748 my $self = shift;
8 14 100       77 if (@_) {
9 2         7 $self->{id} = $_[0];
10 2         6 return $self;
11             }
12             else {
13 12         64 return $self->{id};
14             }
15             }
16              
17             # Class Methods
18             sub new {
19 6     6 1 17 my $error = shift;
20            
21 6         25 my $self = {
22             id => 0,
23             @_
24             };
25            
26 6   33     40 bless $self, ref $error || $error;
27            
28 6         16 return $self;
29             }
30              
31             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 object.
68              
69             Options:
70              
71             =over 2
72              
73             =item * C
74              
75             An error id.
76              
77             =back
78              
79             =head1 Copyright & License
80              
81             Copyright (c) 2023 Yuki Kimoto
82              
83             MIT License