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