line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# FTN::Crypt::Error - Error processing for the FTN::Crypt module |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (C) 2019 by Petr Antonov |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or modify it |
6
|
|
|
|
|
|
|
# under the same terms as Perl 5.10.0. For more details, see the full text |
7
|
|
|
|
|
|
|
# of the licenses at https://opensource.org/licenses/Artistic-1.0, and |
8
|
|
|
|
|
|
|
# http://www.gnu.org/licenses/gpl-2.0.html. |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# This package is provided "as is" and without any express or implied |
11
|
|
|
|
|
|
|
# warranties, including, without limitation, the implied warranties of |
12
|
|
|
|
|
|
|
# merchantability and fitness for a particular purpose. |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package FTN::Crypt::Error; |
16
|
|
|
|
|
|
|
|
17
|
4
|
|
|
4
|
|
31
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
117
|
|
18
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
84
|
|
19
|
4
|
|
|
4
|
|
34
|
use v5.10.1; |
|
4
|
|
|
|
|
13
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#----------------------------------------------------------------------# |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
FTN::Crypt::Error - Error processing for the L<FTN::Crypt> module. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 SYNOPSIS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Inherit your class from FTN::Crypt::Error. Then, to set error message: |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Class->set_error($message) |
32
|
|
|
|
|
|
|
$obj->set_error($message) |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
To get error message: |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Class->error |
37
|
|
|
|
|
|
|
$obj->error |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#----------------------------------------------------------------------# |
42
|
|
|
|
|
|
|
|
43
|
4
|
|
|
4
|
|
35
|
use vars qw/$_ERROR_/; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
929
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
#----------------------------------------------------------------------# |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 new() |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Constructor. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head3 Parameters: |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
None. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head3 Returns: |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Created object. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub new { |
62
|
0
|
|
|
0
|
1
|
0
|
return bless { |
63
|
|
|
|
|
|
|
_ERROR_ => '', |
64
|
|
|
|
|
|
|
}, shift; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#----------------------------------------------------------------------# |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 set_error() |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Set error message. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head3 Parameters: |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over 4 |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * Error message. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=back |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head3 Returns: |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
None. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub set_error { |
88
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
89
|
|
|
|
|
|
|
|
90
|
2
|
50
|
|
|
|
10
|
my $errstr = ref($_[0]) ? shift : join("\n", @_); |
91
|
2
|
50
|
|
|
|
5
|
if (ref($self)) { |
92
|
2
|
|
|
|
|
6
|
$self->{_ERROR_} = $errstr; |
93
|
|
|
|
|
|
|
} else { |
94
|
0
|
|
|
|
|
|
$_ERROR_ = $errstr; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
#----------------------------------------------------------------------# |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 error() |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Get error message. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head3 Parameters: |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
None. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head3 Returns: |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Error message. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub error { |
115
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
116
|
|
|
|
|
|
|
|
117
|
0
|
0
|
|
|
|
|
if (ref($self)) { |
118
|
0
|
0
|
|
|
|
|
return defined $self->{_ERROR_} ? $self->{_ERROR_} : ''; |
119
|
|
|
|
|
|
|
} else { |
120
|
0
|
0
|
|
|
|
|
return defined $_ERROR_ ? $_ERROR_ : ''; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |
125
|
|
|
|
|
|
|
__END__ |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 AUTHOR |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Petr Antonov, E<lt>pietro@cpan.orgE<gt> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Copyright (C) 2019 by Petr Antonov |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it |
136
|
|
|
|
|
|
|
under the same terms as Perl 5.10.0. For more details, see the full text |
137
|
|
|
|
|
|
|
of the licenses at L<https://opensource.org/licenses/Artistic-1.0>, and |
138
|
|
|
|
|
|
|
L<http://www.gnu.org/licenses/gpl-2.0.html>. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This package is provided "as is" and without any express or implied |
141
|
|
|
|
|
|
|
warranties, including, without limitation, the implied warranties of |
142
|
|
|
|
|
|
|
merchantability and fitness for a particular purpose. |