line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
389
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package File::Util::Exception::Diagnostic; |
5
|
|
|
|
|
|
|
$File::Util::Exception::Diagnostic::VERSION = '4.201720'; |
6
|
|
|
|
|
|
|
# ABSTRACT: Diagnostic (verbose) error messages |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use File::Util::Definitions qw( :all ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
184
|
|
9
|
1
|
|
|
1
|
|
5
|
use File::Util::Exception qw( :all ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
77
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
|
|
40
|
use vars qw( |
12
|
|
|
|
|
|
|
@ISA $AUTHORITY |
13
|
|
|
|
|
|
|
@EXPORT_OK %EXPORT_TAGS |
14
|
1
|
|
|
1
|
|
6
|
); |
|
1
|
|
|
|
|
2
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
12
|
use Exporter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
379
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$AUTHORITY = 'cpan:TOMMY'; |
19
|
|
|
|
|
|
|
@ISA = qw( Exporter File::Util::Exception ); |
20
|
|
|
|
|
|
|
@EXPORT_OK = ( '_errors', @File::Util::Exception::EXPORT_OK ); |
21
|
|
|
|
|
|
|
%EXPORT_TAGS = ( all => [ @EXPORT_OK ] ); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%# |
25
|
|
|
|
|
|
|
# DIAGNOSTIC (VERBOSE) ERROR MESSAGES |
26
|
|
|
|
|
|
|
#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%# |
27
|
|
|
|
|
|
|
sub _errors { |
28
|
0
|
|
|
0
|
|
|
my ( $class, $error_thrown ) = @_; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
0
|
|
|
|
$error_thrown ||= $class; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# begin long table of helpful diag error messages |
33
|
0
|
|
|
|
|
|
my %error_msg_table = ( |
34
|
|
|
|
|
|
|
# NO UNICODE SUPPORT |
35
|
|
|
|
|
|
|
'no unicode' => <<'__no_unicode__', |
36
|
|
|
|
|
|
|
$opts->{_pak} can't read/write with (binmode => 'utf8') because your version of |
37
|
|
|
|
|
|
|
Perl is not new enough to support unicode: |
38
|
|
|
|
|
|
|
Your currently running Perl is $EBL$^V$EBR |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Origin: This is a human error. |
41
|
|
|
|
|
|
|
Solution: Upgrade to Perl version 5.008001 (5.8) or newer for unicode support |
42
|
|
|
|
|
|
|
or do not use binmode => 'utf8' in your programs. |
43
|
|
|
|
|
|
|
__no_unicode__ |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# NO SUCH FILE |
46
|
|
|
|
|
|
|
'no such file' => <<'__bad_open__', |
47
|
|
|
|
|
|
|
$opts->{_pak} can't open |
48
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
49
|
|
|
|
|
|
|
because it is inaccessible or does not exist. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Origin: This is *most likely* due to human error. |
52
|
|
|
|
|
|
|
Solution: Cannot diagnose. A human must investigate the problem. |
53
|
|
|
|
|
|
|
__bad_open__ |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# BAD FLOCK RULE POLICY |
57
|
|
|
|
|
|
|
'bad flock rules' => <<'__bad_lockrules__', |
58
|
|
|
|
|
|
|
Invalid file locking policy can not be implemented. $opts->{_pak}::flock_rules |
59
|
|
|
|
|
|
|
does not accept one or more of the policy keywords passed to this method. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Invalid Policy specified: $EBL@{[ |
62
|
|
|
|
|
|
|
join ' ', map { '[undef]' unless defined $_ } @{ $opts->{all} } ]}$EBR |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
flock_rules policy in effect before invalid policy failed: |
65
|
|
|
|
|
|
|
$EBL@ONLOCKFAIL$EBR |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Proper flock_rules policy includes one or more of the following recognized |
68
|
|
|
|
|
|
|
keywords specified in order of precedence: |
69
|
|
|
|
|
|
|
BLOCK waits to try getting an exclusive lock |
70
|
|
|
|
|
|
|
FAIL dies with stack trace |
71
|
|
|
|
|
|
|
WARN warn()s about the error with a stack trace |
72
|
|
|
|
|
|
|
IGNORE ignores the failure to get an exclusive lock |
73
|
|
|
|
|
|
|
UNDEF returns undef |
74
|
|
|
|
|
|
|
ZERO returns 0 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Origin: This is a human error. |
77
|
|
|
|
|
|
|
Solution: A human must fix the programming flaw. |
78
|
|
|
|
|
|
|
__bad_lockrules__ |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# CAN'T READ FILE - PERMISSIONS |
82
|
|
|
|
|
|
|
'cant fread' => <<'__cant_read__', |
83
|
|
|
|
|
|
|
Permissions conflict. $opts->{_pak} can't read the contents of this file: |
84
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Due to insufficient permissions, the system has denied Perl the right to |
87
|
|
|
|
|
|
|
view the contents of this file. It has a bitmask of: (octal number) |
88
|
|
|
|
|
|
|
$EBL@{[ sprintf('%04o',(stat($opts->{filename}))[2] & 0777) ]}$EBR |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
The directory housing it has a bitmask of: (octal number) |
91
|
|
|
|
|
|
|
$EBL@{[ sprintf('%04o',(stat($opts->{dirname}))[2] & 0777) ]}$EBR |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Current flock_rules policy: |
94
|
|
|
|
|
|
|
$EBL@ONLOCKFAIL$EBR |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Origin: This is *most likely* due to human error. External system errors |
97
|
|
|
|
|
|
|
can occur however, but this doesn't have to do with $opts->{_pak}. |
98
|
|
|
|
|
|
|
Solution: A human must fix the conflict by adjusting the file permissions |
99
|
|
|
|
|
|
|
of directories where a program asks $opts->{_pak} to perform I/O. |
100
|
|
|
|
|
|
|
Try using Perl's chmod command, or the native system chmod() |
101
|
|
|
|
|
|
|
command from a shell. |
102
|
|
|
|
|
|
|
__cant_read__ |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# CAN'T READ FILE - NOT EXISTENT |
106
|
|
|
|
|
|
|
'cant fread not found' => <<'__cant_read__', |
107
|
|
|
|
|
|
|
File not found. $opts->{_pak} can't read the contents of this file: |
108
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
The file specified does not exist. It can not be opened or read from. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Origin: This is *most likely* due to human error. External system errors |
113
|
|
|
|
|
|
|
can occur however, but this doesn't have to do with $opts->{_pak}. |
114
|
|
|
|
|
|
|
Solution: A human must investigate why the application tried to open a |
115
|
|
|
|
|
|
|
non-existent file, and/or why the file is expected to exist and |
116
|
|
|
|
|
|
|
is not found. |
117
|
|
|
|
|
|
|
__cant_read__ |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
# CAN'T CREATE FILE - PERMISSIONS |
121
|
|
|
|
|
|
|
'cant fcreate' => <<'__cant_write__', |
122
|
|
|
|
|
|
|
Permissions conflict. $opts->{_pak} can't create this file: |
123
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
$opts->{_pak} can't create this file because the system has denied Perl |
126
|
|
|
|
|
|
|
the right to create files in the parent directory. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
The -e test returns $EBL@{[-e $opts->{dirname} ]}$EBR for the directory. |
129
|
|
|
|
|
|
|
The -r test returns $EBL@{[-r $opts->{dirname} ]}$EBR for the directory. |
130
|
|
|
|
|
|
|
The -R test returns $EBL@{[-R $opts->{dirname} ]}$EBR for the directory. |
131
|
|
|
|
|
|
|
The -w test returns $EBL@{[-w $opts->{dirname} ]}$EBR for the directory |
132
|
|
|
|
|
|
|
The -W test returns $EBL@{[-w $opts->{dirname} ]}$EBR for the directory |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Parent directory: (path may be relative and/or redundant) |
135
|
|
|
|
|
|
|
$EBL$opts->{dirname}$EBR |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Parent directory has a bitmask of: (octal number) |
138
|
|
|
|
|
|
|
$EBL@{[ sprintf('%04o',(stat($opts->{dirname}))[2] & 0777) ]}$EBR |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Current flock_rules policy: |
141
|
|
|
|
|
|
|
$EBL@ONLOCKFAIL$EBR |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Origin: This is *most likely* due to human error. External system errors |
144
|
|
|
|
|
|
|
can occur however, but this doesn't have to do with $opts->{_pak}. |
145
|
|
|
|
|
|
|
Solution: A human must fix the conflict by adjusting the file permissions |
146
|
|
|
|
|
|
|
of directories where a program asks $opts->{_pak} to perform I/O. |
147
|
|
|
|
|
|
|
Try using Perl's chmod command, or the native system chmod() |
148
|
|
|
|
|
|
|
command from a shell. |
149
|
|
|
|
|
|
|
__cant_write__ |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
# CAN'T WRITE TO FILE - EXISTS AS DIRECTORY |
153
|
|
|
|
|
|
|
'cant write_file on a dir' => <<'__bad_writefile__', |
154
|
|
|
|
|
|
|
$opts->{_pak} can't write to the specified file because it already exists |
155
|
|
|
|
|
|
|
as a directory. |
156
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Origin: This is a human error. |
159
|
|
|
|
|
|
|
Solution: Resolve naming issue between the existent directory and the file |
160
|
|
|
|
|
|
|
you wish to create/write/append. |
161
|
|
|
|
|
|
|
__bad_writefile__ |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
# CAN'T TOUCH A FILE - EXISTS AS DIRECTORY |
165
|
|
|
|
|
|
|
'cant touch on a dir' => <<'__bad_touchfile__', |
166
|
|
|
|
|
|
|
$opts->{_pak} can't touch the specified file because it already exists |
167
|
|
|
|
|
|
|
as a directory. |
168
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Origin: This is a human error. |
171
|
|
|
|
|
|
|
Solution: Resolve naming issue between the existent directory and the file |
172
|
|
|
|
|
|
|
you wish to touch. |
173
|
|
|
|
|
|
|
__bad_touchfile__ |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
# CAN'T WRITE TO FILE |
177
|
|
|
|
|
|
|
'cant fwrite' => <<'__cant_write__', |
178
|
|
|
|
|
|
|
Permissions conflict. $opts->{_pak} can't write to this file: |
179
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Due to insufficient permissions, the system has denied Perl the right |
182
|
|
|
|
|
|
|
to modify the contents of this file. It has a bitmask of: (octal number) |
183
|
|
|
|
|
|
|
$EBL@{[ sprintf('%04o',(stat($opts->{filename}))[2] & 0777) ]}$EBR |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Parent directory has a bitmask of: (octal number) |
186
|
|
|
|
|
|
|
$EBL@{[ sprintf('%04o',(stat($opts->{dirname}))[2] & 0777) ]}$EBR |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Current flock_rules policy: |
189
|
|
|
|
|
|
|
$EBL@ONLOCKFAIL$EBR |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Origin: This is *most likely* due to human error. External system errors |
192
|
|
|
|
|
|
|
can occur however, but this doesn't have to do with $opts->{_pak}. |
193
|
|
|
|
|
|
|
Solution: A human must fix the conflict by adjusting the file permissions |
194
|
|
|
|
|
|
|
of directories where a program asks $opts->{_pak} to perform I/O. |
195
|
|
|
|
|
|
|
Try using Perl's chmod command, or the native system chmod() |
196
|
|
|
|
|
|
|
command from a shell. |
197
|
|
|
|
|
|
|
__cant_write__ |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
# BAD OPEN MODE - PERL |
201
|
|
|
|
|
|
|
'bad openmode popen' => <<'__bad_openmode__', |
202
|
|
|
|
|
|
|
Illegal mode specified for file open. $opts->{_pak} can't open this file: |
203
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
When calling $opts->{_pak}::$opts->{meth}() you specified that the file |
206
|
|
|
|
|
|
|
opened in this I/O operation should be opened in $EBL$opts->{badmode}$EBR |
207
|
|
|
|
|
|
|
but that is not a recognized open mode. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
Supported open modes for $opts->{_pak}::write_file() are: |
210
|
|
|
|
|
|
|
write - open the file in write mode, creating it if necessary, and |
211
|
|
|
|
|
|
|
overwriting any existing contents of the file. |
212
|
|
|
|
|
|
|
append - open the file in append mode |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Supported open modes for $opts->{_pak}::open_handle() are the same as above, but |
215
|
|
|
|
|
|
|
also include the following: |
216
|
|
|
|
|
|
|
read - open the file in read-only mode |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
(and if the "use_sysopen => 1" flag is used): |
219
|
|
|
|
|
|
|
rwcreate - open the file for update (read+write), creating it if necessary |
220
|
|
|
|
|
|
|
rwupdate - open the file for update (read+write). Causes fatal error if |
221
|
|
|
|
|
|
|
the file doesn't yet exist |
222
|
|
|
|
|
|
|
rwappend - open the file for update in append mode |
223
|
|
|
|
|
|
|
rwclobber - open the file for update, erasing all contents (truncating, |
224
|
|
|
|
|
|
|
i.e- "clobbering" the file first) |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Origin: This is a human error. |
227
|
|
|
|
|
|
|
Solution: A human must fix the programming flaw by specifying the desired |
228
|
|
|
|
|
|
|
open mode from the list above. |
229
|
|
|
|
|
|
|
__bad_openmode__ |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
# BAD OPEN MODE - SYSOPEN |
233
|
|
|
|
|
|
|
'bad openmode sysopen' => <<'__bad_openmode__', |
234
|
|
|
|
|
|
|
Illegal mode specified for file sysopen. $opts->{_pak} can't sysopen this file: |
235
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
When calling $opts->{_pak}::$opts->{meth}() you specified that the file |
238
|
|
|
|
|
|
|
opened in this I/O operation should be sysopen()'d in $EBL$opts->{badmode}$EBR |
239
|
|
|
|
|
|
|
but that is not a recognized open mode. |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
Supported open modes for $opts->{_pak}::write_file() are: |
242
|
|
|
|
|
|
|
write - open the file in write mode, creating it if necessary, and |
243
|
|
|
|
|
|
|
overwriting any existing contents of the file. |
244
|
|
|
|
|
|
|
append - open the file in append mode |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
Supported open modes for $opts->{_pak}::open_handle() are the same as above, but |
247
|
|
|
|
|
|
|
also include the following: |
248
|
|
|
|
|
|
|
read - open the file in read-only mode |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
(and if the "use_sysopen => 1" flag is used, as the application JUST did): |
251
|
|
|
|
|
|
|
rwcreate - open the file for update (read+write), creating it if necessary |
252
|
|
|
|
|
|
|
rwupdate - open the file for update (read+write). Causes fatal error if |
253
|
|
|
|
|
|
|
the file doesn't yet exist |
254
|
|
|
|
|
|
|
rwappend - open the file for update in append mode |
255
|
|
|
|
|
|
|
rwclobber - open the file for update, erasing all contents (truncating, |
256
|
|
|
|
|
|
|
i.e- "clobbering" the file first) |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
Origin: This is a human error. |
259
|
|
|
|
|
|
|
Solution: A human must fix the programming flaw by specifying the desired |
260
|
|
|
|
|
|
|
sysopen mode from the list above. |
261
|
|
|
|
|
|
|
__bad_openmode__ |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
# CAN'T LIST DIRECTORY |
265
|
|
|
|
|
|
|
'cant dread' => <<'__cant_read__', |
266
|
|
|
|
|
|
|
Permissions conflict. $opts->{_pak} can't list the contents of this directory: |
267
|
|
|
|
|
|
|
$EBL$opts->{dirname}$EBR |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
Due to insufficient permissions, the system has denied Perl the right to |
270
|
|
|
|
|
|
|
view the contents of this directory. It has a bitmask of: (octal number) |
271
|
|
|
|
|
|
|
$EBL@{[ sprintf('%04o',(stat($opts->{dirname}))[2] & 0777) ]}$EBR |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
Origin: This is *most likely* due to human error. External system errors |
274
|
|
|
|
|
|
|
can occur however, but this doesn't have to do with $opts->{_pak}. |
275
|
|
|
|
|
|
|
Solution: A human must fix the conflict by adjusting the file permissions |
276
|
|
|
|
|
|
|
of directories where a program asks $opts->{_pak} to perform I/O. |
277
|
|
|
|
|
|
|
Try using Perl's chmod command, or the native system chmod() |
278
|
|
|
|
|
|
|
command from a shell. |
279
|
|
|
|
|
|
|
__cant_read__ |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
# CAN'T CREATE DIRECTORY - PERMISSIONS |
283
|
|
|
|
|
|
|
'cant dcreate' => <<'__cant_dcreate__', |
284
|
|
|
|
|
|
|
Permissions conflict. $opts->{_pak} can't create: |
285
|
|
|
|
|
|
|
$EBL$opts->{dirname}$EBR |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
$opts->{_pak} can't create this directory because the system has denied |
288
|
|
|
|
|
|
|
Perl the right to create files in the parent directory. |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
Parent directory: (path may be relative and/or redundant) |
291
|
|
|
|
|
|
|
$EBL$opts->{parentd}$EBR |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
Parent directory has a bitmask of: (octal number) |
294
|
|
|
|
|
|
|
$EBL@{[ sprintf('%04o',(stat($opts->{parentd}))[2] & 0777) ]}$EBR |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
Origin: This is *most likely* due to human error. External system errors |
297
|
|
|
|
|
|
|
can occur however, but this doesn't have to do with $opts->{_pak}. |
298
|
|
|
|
|
|
|
Solution: A human must fix the conflict by adjusting the file permissions |
299
|
|
|
|
|
|
|
of directories where a program asks $opts->{_pak} to perform I/O. |
300
|
|
|
|
|
|
|
Try using Perl's chmod command, or the native system chmod() |
301
|
|
|
|
|
|
|
command from a shell. |
302
|
|
|
|
|
|
|
__cant_dcreate__ |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
# CAN'T CREATE DIRECTORY - TARGET EXISTS |
306
|
|
|
|
|
|
|
'make_dir target exists' => <<'__cant_dcreate__', |
307
|
|
|
|
|
|
|
make_dir target already exists. |
308
|
|
|
|
|
|
|
$EBL$opts->{dirname}$EBR |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
$opts->{_pak} can't create the directory you specified because that |
311
|
|
|
|
|
|
|
directory already exists, with filetype attributes of |
312
|
|
|
|
|
|
|
@{[join(', ', @{ $opts->{filetype} })]} and permissions |
313
|
|
|
|
|
|
|
set to $EBL@{[ sprintf('%04o',(stat($opts->{dirname}))[2] & 0777) ]}$EBR |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
Origin: This is *most likely* due to human error. The program has tried |
316
|
|
|
|
|
|
|
to make a directory where a directory already exists. |
317
|
|
|
|
|
|
|
Solution: Weaken the requirement somewhat by using the "if_not_exists => 1" |
318
|
|
|
|
|
|
|
flag when calling the make_dir object method. This option |
319
|
|
|
|
|
|
|
will cause $opts->{_pak} to ignore attempts to create directories |
320
|
|
|
|
|
|
|
that already exist, while still creating the ones that don't. |
321
|
|
|
|
|
|
|
__cant_dcreate__ |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
# CAN'T OPEN |
325
|
|
|
|
|
|
|
'bad open' => <<'__bad_open__', |
326
|
|
|
|
|
|
|
$opts->{_pak} can't open this file for $EBL$opts->{mode}$EBR: |
327
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
The system returned this error: |
330
|
|
|
|
|
|
|
$EBL$opts->{exception}$EBR |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
$opts->{_pak} used this directive in its attempt to open the file |
333
|
|
|
|
|
|
|
$EBL$opts->{cmd}$EBR |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
Current flock_rules policy: |
336
|
|
|
|
|
|
|
$EBL@ONLOCKFAIL$EBR |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
Origin: This is *most likely* due to human error. |
339
|
|
|
|
|
|
|
Solution: Cannot diagnose. A Human must investigate the problem. |
340
|
|
|
|
|
|
|
__bad_open__ |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
# BAD CLOSE |
344
|
|
|
|
|
|
|
'bad close' => <<'__bad_close__', |
345
|
|
|
|
|
|
|
$opts->{_pak} couldn't close this file after $EBL$opts->{mode}$EBR |
346
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
The system returned this error: |
349
|
|
|
|
|
|
|
$EBL$opts->{exception}$EBR |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
Current flock_rules policy: |
352
|
|
|
|
|
|
|
$EBL@ONLOCKFAIL$EBR |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
Origin: Could be either human _or_ system error. |
355
|
|
|
|
|
|
|
Solution: Cannot diagnose. A Human must investigate the problem. |
356
|
|
|
|
|
|
|
__bad_close__ |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
# CAN'T TRUNCATE |
360
|
|
|
|
|
|
|
'bad systrunc' => <<'__bad_systrunc__', |
361
|
|
|
|
|
|
|
$opts->{_pak} couldn't truncate() on $EBL$opts->{filename}$EBR after having |
362
|
|
|
|
|
|
|
successfully opened the file in write mode. |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
The system returned this error: |
365
|
|
|
|
|
|
|
$EBL$opts->{exception}$EBR |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
Current flock_rules policy: |
368
|
|
|
|
|
|
|
$EBL@ONLOCKFAIL$EBR |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
This is most likely _not_ a human error, but has to do with your system's |
371
|
|
|
|
|
|
|
support for the C truncate() function. |
372
|
|
|
|
|
|
|
__bad_systrunc__ |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
# CAN'T GET FLOCK AFTER BLOCKING |
376
|
|
|
|
|
|
|
'bad flock' => <<'__bad_lock__', |
377
|
|
|
|
|
|
|
$opts->{_pak} can't get a lock on the file |
378
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
The system returned this error: |
381
|
|
|
|
|
|
|
$EBL$opts->{exception}$EBR |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
Current flock_rules policy: |
384
|
|
|
|
|
|
|
$EBL@ONLOCKFAIL$EBR |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
Origin: Could be either human _or_ system error. |
387
|
|
|
|
|
|
|
Solution: Investigate the reason why you can't get a lock on the file, |
388
|
|
|
|
|
|
|
it is usually because of improper programming which causes |
389
|
|
|
|
|
|
|
race conditions on one or more files. |
390
|
|
|
|
|
|
|
__bad_lock__ |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
# CAN'T OPEN ON A DIRECTORY |
394
|
|
|
|
|
|
|
'called open on a dir' => <<'__bad_open__', |
395
|
|
|
|
|
|
|
$opts->{_pak} can't call open() on this file because it is a directory |
396
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
Origin: This is a human error. |
399
|
|
|
|
|
|
|
Solution: Use $opts->{_pak}::load_file() to load the contents of a file |
400
|
|
|
|
|
|
|
Use $opts->{_pak}::list_dir() to list the contents of a directory |
401
|
|
|
|
|
|
|
__bad_open__ |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
# CAN'T OPENDIR ON A FILE |
405
|
|
|
|
|
|
|
'called opendir on a file' => <<'__bad_open__', |
406
|
|
|
|
|
|
|
$opts->{_pak} can't opendir() on this file because it is not a directory. |
407
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
Use $opts->{_pak}::load_file() to load the contents of a file |
410
|
|
|
|
|
|
|
Use $opts->{_pak}::list_dir() to list the contents of a directory |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
Origin: This is a human error. |
413
|
|
|
|
|
|
|
Solution: Use $opts->{_pak}::load_file() to load the contents of a file |
414
|
|
|
|
|
|
|
Use $opts->{_pak}::list_dir() to list the contents of a directory |
415
|
|
|
|
|
|
|
__bad_open__ |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
# CAN'T MKDIR ON A FILE |
419
|
|
|
|
|
|
|
'called mkdir on a file' => <<'__bad_open__', |
420
|
|
|
|
|
|
|
$opts->{_pak} can't auto-create a directory for this path name because it |
421
|
|
|
|
|
|
|
already exists as a file. |
422
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
Origin: This is a human error. |
425
|
|
|
|
|
|
|
Solution: Resolve naming issue between the existent file and the directory |
426
|
|
|
|
|
|
|
you wish to create. |
427
|
|
|
|
|
|
|
__bad_open__ |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
# BAD CALL TO File::Util::read_limit |
431
|
|
|
|
|
|
|
'bad read_limit' => <<'__read_limit__', |
432
|
|
|
|
|
|
|
Bad call to $opts->{_pak}::read_limit(). This method can only be called with |
433
|
|
|
|
|
|
|
a numeric value (bytes). Non-integer numbers will be converted to integer |
434
|
|
|
|
|
|
|
format if specified (numbers like 5.2), but don't do that, it's inefficient. |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
This operation aborted. |
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
Origin: This is a human error. |
439
|
|
|
|
|
|
|
Solution: A human must fix the programming flaw. |
440
|
|
|
|
|
|
|
__read_limit__ |
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
# EXCEEDED READ_LIMIT |
444
|
|
|
|
|
|
|
'read_limit exceeded' => <<'__read_limit__', |
445
|
|
|
|
|
|
|
$opts->{_pak} can't load file: $EBL$opts->{filename}$EBR |
446
|
|
|
|
|
|
|
into memory because its size exceeds the maximum file size allowed |
447
|
|
|
|
|
|
|
for a read. |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
The size of this file is $EBL$opts->{size}$EBR bytes. |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
Currently the read limit is set at $EBL$opts->{read_limit}$EBR bytes. |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
Origin: This is a human error. |
454
|
|
|
|
|
|
|
Solution: Consider setting the limit to a higher number of bytes. |
455
|
|
|
|
|
|
|
__read_limit__ |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
# BAD CALL TO File::Util::abort_depth |
459
|
|
|
|
|
|
|
'bad abort_depth' => <<'__abort_depth__', |
460
|
|
|
|
|
|
|
Bad call to $opts->{_pak}::abort_depth(). This method can only be called with |
461
|
|
|
|
|
|
|
a numeric value (bytes). Non-integer numbers will be converted to integer |
462
|
|
|
|
|
|
|
format if specified (numbers like 5.2), but don't do that, it's inefficient. |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
This operation aborted. |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
Origin: This is a human error. |
467
|
|
|
|
|
|
|
Solution: A human must fix the programming flaw. |
468
|
|
|
|
|
|
|
__abort_depth__ |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
# EXCEEDED ABORT_DEPTH |
472
|
|
|
|
|
|
|
'abort_depth exceeded' => <<'__abort_depth__', |
473
|
|
|
|
|
|
|
Recursion limit reached at $EBL${\ scalar( |
474
|
|
|
|
|
|
|
(exists $opts->{abort_depth} && defined $opts->{abort_depth}) ? |
475
|
|
|
|
|
|
|
$opts->{abort_depth} : $ABORT_DEPTH) |
476
|
|
|
|
|
|
|
}$EBR dives. The maximum level of subdirectory depth is set to the value |
477
|
|
|
|
|
|
|
returned by $opts->{_pak}::abort_depth(). Try manually setting the value to a |
478
|
|
|
|
|
|
|
higher number by calling list_dir() with the "abort_depth => N" option where N |
479
|
|
|
|
|
|
|
is a positive integer value. To set the default abort_depth for all recursive |
480
|
|
|
|
|
|
|
list_dir() calls, invoke $opts->{_pak}::abort_depth() with the numeric argument |
481
|
|
|
|
|
|
|
corresponding to the maximum number of subdirectory dives you want to allow. |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
This operation aborted. |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
Origin: This is a human error. |
486
|
|
|
|
|
|
|
Solution: Consider setting the limit to a higher number. |
487
|
|
|
|
|
|
|
__abort_depth__ |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
# BAD OPENDIR |
491
|
|
|
|
|
|
|
'bad opendir' => <<'__bad_opendir__', |
492
|
|
|
|
|
|
|
$opts->{_pak} can't opendir on directory: |
493
|
|
|
|
|
|
|
$EBL$opts->{dirname}$EBR |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
The system returned this error: |
496
|
|
|
|
|
|
|
$EBL$opts->{exception}$EBR |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
Origin: Could be either human _or_ system error. |
499
|
|
|
|
|
|
|
Solution: Cannot diagnose. A Human must investigate the problem. |
500
|
|
|
|
|
|
|
__bad_opendir__ |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
# BAD MAKEDIR |
504
|
|
|
|
|
|
|
'bad make_dir' => <<'__bad_make_dir__', |
505
|
|
|
|
|
|
|
$opts->{_pak} had a problem with the system while attempting to create the |
506
|
|
|
|
|
|
|
directory you specified with a bitmask of $EBL$opts->{bitmask}$EBR |
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
directory: $EBL$opts->{dirname}$EBR |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
The system returned this error: |
511
|
|
|
|
|
|
|
$EBL$opts->{exception}$EBR |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
Origin: Could be either human _or_ system error. |
514
|
|
|
|
|
|
|
Solution: Cannot diagnose. A Human must investigate the problem. |
515
|
|
|
|
|
|
|
__bad_make_dir__ |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
# BAD CHARS |
519
|
|
|
|
|
|
|
'bad chars' => <<'__bad_chars__', |
520
|
|
|
|
|
|
|
$opts->{_pak} can't use this string for $EBL$opts->{purpose}$EBR. |
521
|
|
|
|
|
|
|
$EBL$opts->{string}$EBR |
522
|
|
|
|
|
|
|
It contains illegal characters. |
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
Illegal characters are: |
525
|
|
|
|
|
|
|
\\ (backslash) |
526
|
|
|
|
|
|
|
/ (forward slash) |
527
|
|
|
|
|
|
|
: (colon) |
528
|
|
|
|
|
|
|
| (pipe) |
529
|
|
|
|
|
|
|
* (asterisk) |
530
|
|
|
|
|
|
|
? (question mark) |
531
|
|
|
|
|
|
|
" (double quote) |
532
|
|
|
|
|
|
|
< (less than) |
533
|
|
|
|
|
|
|
> (greater than) |
534
|
|
|
|
|
|
|
\\t (tab) |
535
|
|
|
|
|
|
|
\\ck (vertical tabulator) |
536
|
|
|
|
|
|
|
\\r (newline CR) |
537
|
|
|
|
|
|
|
\\n (newline LF) |
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
Origin: This is a human error. |
540
|
|
|
|
|
|
|
Solution: A human must remove the illegal characters from this string. |
541
|
|
|
|
|
|
|
__bad_chars__ |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
# CAN'T USE UTF8 WITH SYSOPEN |
545
|
|
|
|
|
|
|
'bad binmode' => <<'__bad_binmode__', |
546
|
|
|
|
|
|
|
IO discipline conflict. $opts->{_pak} can't properly perform IO to this file |
547
|
|
|
|
|
|
|
while using the options you specified: |
548
|
|
|
|
|
|
|
$EBL$opts->{filename}$EBR |
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
The use of system IO (sysread/syswrite/etc) on utf8 file handles is deprecated, |
551
|
|
|
|
|
|
|
and causes portability/reliability problems. To learn more, you can read the |
552
|
|
|
|
|
|
|
notes regarding binmode in `perldoc perlport`. |
553
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
In short, please don't use these conflicting options together: |
555
|
|
|
|
|
|
|
use_sysopen => 1 |
556
|
|
|
|
|
|
|
binmode => 'utf8' |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
Origin: This is a human error. |
559
|
|
|
|
|
|
|
Solution: A human must make a change to the code which calls |
560
|
|
|
|
|
|
|
$opts->{_pak}::$opts->{meth}(), so that it does not contain |
561
|
|
|
|
|
|
|
conflicting options. Either use binmode => 'utf8' without the |
562
|
|
|
|
|
|
|
use_sysopen option, or don't direct $opts->{_pak}::$opts->{meth}() |
563
|
|
|
|
|
|
|
to 'use_sysopen'. |
564
|
|
|
|
|
|
|
__bad_binmode__ |
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
# NOT A VALID FILEHANDLE |
568
|
|
|
|
|
|
|
'not a filehandle' => <<'__bad_handle__', |
569
|
|
|
|
|
|
|
$opts->{_pak} can't unlock file with an invalid file handle reference: |
570
|
|
|
|
|
|
|
$EBL$opts->{argtype}$EBR is not a valid filehandle |
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
Origin: This is most likely a human error, although it is remotely possible |
573
|
|
|
|
|
|
|
that this message is the result of an internal error in the |
574
|
|
|
|
|
|
|
$opts->{_pak} module, but this is not likely if you called |
575
|
|
|
|
|
|
|
$opts->{_pak}'s internal ::_release() method directly on your own. |
576
|
|
|
|
|
|
|
Solution: A human must fix the programming flaw. Alternatively, in the second |
577
|
|
|
|
|
|
|
listed scenario the package maintainer must investigate the problem. |
578
|
|
|
|
|
|
|
Please submit a bug report with this error message in its entirety |
579
|
|
|
|
|
|
|
at https://rt.cpan.org/Dist/Display.html?Name=File%3A%3AUtil |
580
|
|
|
|
|
|
|
__bad_handle__ |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
# BAD CALL TO METHOD FOO |
584
|
|
|
|
|
|
|
'no input' => <<'__no_input__', |
585
|
|
|
|
|
|
|
$opts->{_pak} can't honor your call to $EBL$opts->{_pak}::$opts->{meth}()$EBR |
586
|
|
|
|
|
|
|
because you didn't provide $EBL@{[$opts->{missing}||'the required input']}$EBR |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
Origin: This is a human error. |
589
|
|
|
|
|
|
|
Solution: A human must fix the programming flaw. |
590
|
|
|
|
|
|
|
__no_input__ |
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
# PLAIN ERROR TYPE |
594
|
|
|
|
|
|
|
'plain error' => <<'__plain_error__', |
595
|
|
|
|
|
|
|
$opts->{_pak} failed with the following message: |
596
|
|
|
|
|
|
|
${\ scalar ($_[0] || ((exists $opts->{error} && defined $opts->{error}) ? |
597
|
|
|
|
|
|
|
$opts->{error} : '[error unspecified]')) } |
598
|
|
|
|
|
|
|
__plain_error__ |
599
|
|
|
|
|
|
|
|
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
# INVALID ERROR TYPE |
602
|
|
|
|
|
|
|
'unknown error message' => <<'__foobar_input__', |
603
|
|
|
|
|
|
|
$opts->{_pak} failed with an invalid error-type designation. |
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
Origin: This is a bug! Please file a bug report at |
606
|
|
|
|
|
|
|
https://rt.cpan.org/Dist/Display.html?Name=File%3A%3AUtil |
607
|
|
|
|
|
|
|
Solution: A human must fix the programming flaw. |
608
|
|
|
|
|
|
|
__foobar_input__ |
609
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
# EMPTY ERROR TYPE |
612
|
|
|
|
|
|
|
'empty error' => <<'__no_input__', |
613
|
|
|
|
|
|
|
$opts->{_pak} failed with an empty error-type designation. |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
Origin: This is a human error. |
616
|
|
|
|
|
|
|
Solution: A human must fix the programming flaw. |
617
|
|
|
|
|
|
|
__no_input__ |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
); # end of error message table |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
exists $error_msg_table{ $error_thrown } |
622
|
|
|
|
|
|
|
? $error_msg_table{ $error_thrown } |
623
|
0
|
0
|
|
|
|
|
: $error_msg_table{'unknown error message'} |
624
|
|
|
|
|
|
|
} |
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
# -------------------------------------------------------- |
628
|
|
|
|
|
|
|
# File::Util::Exception::Diagnostic::DESTROY() |
629
|
|
|
|
|
|
|
# -------------------------------------------------------- |
630
|
|
|
|
1
|
|
|
sub DESTROY { } |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
1; |
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
__END__ |