If $^E is empty, the command ran successfullyYes, but the command can run successfully and, yet, there will still be an error message in $^E (which is merely the
last error, n'est-ce pas ?). When I run the script you provided I get the following output:
C:\_32\pscrpt>perl try.pl
Successful command returning 1
![Bad file descriptor] ?[256 : 1] E[The specified image file did not c
+ontain a r
esource section]
Nonexistant command, attempted direct but fallback to via cmd
'c:/doesNotExists.exe' is not recognized as an internal or external co
+mmand,
operable program or batch file.
![No such file or directory] ?[256 : 1] E[There are no more files]
Nonexistant via cmd because of the presence of shell chars sending std
+err >null
![No such file or directory] ?[256 : 1] E[There are no more files]
Admittedly 1) and 3) are different, but I wouldn't like to have to work out which had succeeded and which had failed based solely upon the ouptut :-)
I'm at a loss for the moment to understand why the expected error message
never appears in $^E for me. (I'm on Windows Vista - but I don't think that's an issue. I'll switch to XP and see what happens.)
Cheers,
Rob
Update:On Windows 2000 I find that
BrowserUk's script runs as he has reported. However, if one inserts a
system'c:/doesNotExist.exe'; immediately below the
use strict; in
BrowserUk's script then $^E is no longer useful for determining whether the other three ensuing commands ran successfully or not. (My XP laptop has shit itself again, so I had to resort to Windows 2000).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.