Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I don't like to see "Unknown error" dozens of times. So I prefer the longer:

# Win32: perl -e "print grep !/unknown error/i, map $_.qq'\t'.($!=$_).$/, 0..12 +7" # Other: perl -e 'print grep !/unknown error/i, map $_."\t".($!=$_).$/, 0..127'
Or you can get fancy like:
# Win32: perl -MErrno -e "my %e= map { Errno->$_()=>$_ } keys(%!); print grep ! +/unknown error/i, map sprintf('%4d %-12s %s'.$/,$_,$e{$_},$!=$_), 0.. +127" # Other: perl -MErrno -e 'my %e= map { Errno->$_()=>$_ } keys(%!); print grep ! +/unknown error/i, map sprintf("%4d %-12s %s".$/,$_,$e{$_},$!=$_), 0.. +127'
which produces output like:
0 1 EPERM Operation not permitted 2 ENOENT No such file or directory 3 ESRCH No such process 4 EINTR Interrupted function call
Enjoy. (:

Update: Change the /unknown error/i bit to match your platform. I expected Perl to just use the standard strerror() but it appears that this code is split up much more than that and unknown error codes are handled rather differently on different platforms (the "Unknown error" is in Win32-specific source code for Perl).

                - tye

In reply to Re: List standard Unix error codes (less output, more code) by tye
in thread List standard Unix error codes by jmcnamara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-23 09:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found