in reply to Re: An example of programming by contract
in thread An example of programming by contract

It is indeed possible to set $! in user code.

perl -e 'print ("$_ gives ", ($!=$_), "\n") for 1..20'
However you will note that its behaviour is highly magical and (unless you do some magic of your own) not particularly usable for any purpose other than its intended.

Replies are listed 'Best First'.
Re: Re (tilly) 2: An example of programming by contract
by blakem (Monsignor) on Nov 26, 2001 at 07:21 UTC
    Thats kind of cool....
    122 gives Disk quota exceeded 123 gives No medium found 124 gives Wrong medium type 125 gives Unknown error 125 126 gives Unknown error 126 127 gives Unknown error 127
    Think a patch to set error 125 to 'Just another Perl hacker' would be frowned upon... ;-)

    -Blake