There are many Perl defined system variables that you can use in your script, one of them is "$!", When used in a numeric context, holds the current value of errno. If used in a string context, will hold the error string associated with errno.
Below is simple Perl script which prints all available system error message and their corresponding error codes.
Source: error_message.pl
#!/usr/bin/perl
for ($! = 1, $i = 1; $! <= 25; $!++, $i++) {
$errormsg = $!;
chomp($errormsg);
print "$i : $! \n";
}
Output: perl error_message.pl
0001: Operation not permitted
0002: No such file or directory
0003: No such process
0004: Interrupted system call
0005: Input/output error
0006: No such device or address
0007: Argument list too long
0008: Exec format error
0009: Bad file descriptor
0010: No child processes
0011: Resource temporarily unavailable
0012: Cannot allocate memory
0013: Permission denied
0014: Bad address
0015: Block device required
0016: Device or resource busy
0017: File exists
0018: Invalid cross-device link
0019: No such device
0020: Not a directory
0021: Is a directory
0022: Invalid argument
0023: Too many open files in system
0024: Too many open files
0025: Inappropriate ioctl for device
There are many more system error messages, if you want to list all of them, just increase the above loop from 25 to 1000.
Below is simple Perl script which prints all available system error message and their corresponding error codes.
Source: error_message.pl
#!/usr/bin/perl
for ($! = 1, $i = 1; $! <= 25; $!++, $i++) {
$errormsg = $!;
chomp($errormsg);
print "$i : $! \n";
}
Output: perl error_message.pl
0001: Operation not permitted
0002: No such file or directory
0003: No such process
0004: Interrupted system call
0005: Input/output error
0006: No such device or address
0007: Argument list too long
0008: Exec format error
0009: Bad file descriptor
0010: No child processes
0011: Resource temporarily unavailable
0012: Cannot allocate memory
0013: Permission denied
0014: Bad address
0015: Block device required
0016: Device or resource busy
0017: File exists
0018: Invalid cross-device link
0019: No such device
0020: Not a directory
0021: Is a directory
0022: Invalid argument
0023: Too many open files in system
0024: Too many open files
0025: Inappropriate ioctl for device
There are many more system error messages, if you want to list all of them, just increase the above loop from 25 to 1000.
0 comments:
Post a Comment