At work I learned about a tool called perror, that showed the literal string corresponding to a numeric UNIX error. So if you get a message from a program that says "errno 13", you can run perror to easily translate that into "Permission denied". When I went to install it at home, I found out that it's in Debian package mysql-server (!). So I made my own version:
foreach (grep /^\d+$/, @ARGV) { $! = $_; print "$_: $!"; }
Which can be turned into a oneliner:
$ perl -le'print "$_: ", $! = $_ foreach grep /^\d+$/, @ARGV' 13 20 +## It even respects your locale settings 13: Permiso denegado 20: No es un directorio
--
David Serrano
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perror.pl
by samtregar (Abbot) on Jul 05, 2006 at 17:20 UTC | |
by Hue-Bond (Priest) on Jul 05, 2006 at 18:33 UTC |