cpan you have to see

Abigail abigail at abigail.be
Sat Dec 15 08:45:03 GMT 2012


On Sat, Dec 15, 2012 at 12:23:29AM +0000, David Cantrell wrote:
> On Wed, Dec 12, 2012 at 05:23:23PM +0000, Edmund von der Burg wrote:
> 
> > Each language has its own idioms and ways to do things. In shell
> > scripting the while true ... done loop is one of them.
> > 
> > In Perl the equivalent would be while (1) { .... }
> 
> Although true is 0 in the shell ...
> 
> $ true;echo $?
> 0
> $ true && echo "it was true"
> it was true
> 
> which is bloody irritating.
> 


Nah, it's doing the right thing.

One has a single byte to determine success or failure. The convention
is to use a single value to determine success, and the rest to specify
why there is a failure. And then the shell makes its boolean operators
do the right thing.

It be utter madness to have programs exit '0' on failure, and given 
them 254 different exit values to indicate in which way they were
succesful.


Abigail


More information about the london.pm mailing list