I use $? to detect errors, but I also use shell scripts to interface with MySQL in a batch mode. Perl is just ... too heavy for this.
In Perl, you might have to do something like if ($? >> 8) to get it to work right. (I forget the exact syntax and where in the bytes the actual error is stored.)
Being right, does not endow the right to be rude; politeness costs nothing. Being unknowing, is not the same as being stupid. Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence. Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
| [reply] [d/l] |
I was thinking of something similar:
if ($? ne 0) {
print ERRLOG "$FILE";
}
Does $? work with NT in perl?
| [reply] |
I don't develop on NT, but I would assume so. Test it out with pg's example further down in the thread and see what happens.
Personally, unless there is some overriding reason why you have to have this be portable across both Unix and NT, I would write it for one system. And, I would write it in the shell scripting language of that system. That's what shell scripting is for.
Being right, does not endow the right to be rude; politeness costs nothing. Being unknowing, is not the same as being stupid. Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence. Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
| [reply] |