develooper Front page | perl.perl5.porters | Postings from September 2003

Re: [perl #23779] AutoReply: $? and negative exit codes

From:
Tels
Date:
September 10, 2003 14:43
Subject:
Re: [perl #23779] AutoReply: $? and negative exit codes
Message ID:
200309102343.46008@bloodgate.com
-----BEGIN PGP SIGNED MESSAGE-----

Moin,

doh, I forgot the most important example:

> I thought problem is with '>>' and negative values, but:
>
> te@null:~> perl -le 'system "perl exit.pl -1"; $exit_code = int($? / 256);
> print "$exit_code $?"'
> 255 65280
>
> Maybe this is simple a unsigned vs. signed issue? On a different system
> were I noticed this first I would get the decimal equivalent of "0xFFFFFFFF
> >> 1", e.g. 2147483647 for $?.
>
> Now, compare this to:
>
> 	te@null:~> perl -le 'system "exit.pl -1"; $exit_code = int($? / 256);
> print "$exit_code $?"'
> 	0 -1

Watch this:

	te@null:~/perl/File-Spec> perl -le 'system "exit.pl -1"; $exit_code = $? >>
8; print "$exit_code $?"'
	16777215 -1

*pours cup of klatchian coffee*

Best wishes,

Tels

- --
 Signed on Wed Sep 10 23:41:50 2003 with key 0x93B84C15.
 PGP key on http://bloodgate.com/tels.asc or per email.

 "Naturally the parameter and boundary of their respective position and
 magnitude are naturally determinable up to the limits of possible
 measurement as stated by the general quantum hypothesis and Heisenberg's
 uncertainty principle, but this indeterminacy in precise value is not a
 consequence of quantum uncertainty. What this illustrates is that in
 relation to indeterminacy in precise physical magnitude, the micro and
 macroscopic are inextricably linked, both being a part of the same parcel,
 rather than just a case of the former underlying and contributing to the
 latter." -- Peter Lynd

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
Comment: When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.

iQEVAwUBP1+bJHcLPEOTuEwVAQEHLwf/TZw1Dm1zKOQHvgl9Pr9eSUc+AGAKKOZ3
15MqMOoZ7kh/x52yWo+c9FKE0hUvGrMb2KnpV4mCkJR3wiwkBdvBUTuQGXe6iNbj
r/wR48QMJ4CBR/qwMu6pWnxo+hpFkAKeF3UoXF+HPfMs6UbwqTy7lovPgeCPgUBf
LNkMIJXiZfwxHngabvxNa5KXx0aXpRWNkz/Wj54sDXWecTYMbY5C0ujDqtBjAcqt
lKOwVNlGE4GIGiaoo7pygiVAzGRVr4xNKJcF/acGvLv/nJbjjXrsR8HCLQ8yu5nd
rrvwl05r8kV6A+FkWPG2b50EnjRSxO/uvk1u0OUIiTWta8VP8HaxCg==
=Pn1E
-----END PGP SIGNATURE-----




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About