At 15:28 -0800 2003.04.02, Nicholas G. Thornton wrote:
>.. but if the input is fine it returns either the input (as it's currently
>designed) or a true value (the easier way). Either way I was wondering how to
>set $! since = doesn't seem to work.

You can set $! to any integer, and its return value is mapped to the
corresponding system error.  For example, under Mac OS X:

  [EMAIL PROTECTED] pudge]$ perl -le 'for (0..20) { $! = $_; print $! }'

  Operation not permitted
  No such file or directory
  No such process
  Interrupted system call
  Input/output error
  Device not configured
  Argument list too long
  Exec format error
  Bad file descriptor
  No child processes
  Resource deadlock avoided
  Cannot allocate memory
  Permission denied
  Bad address
  Block device required
  Device busy
  File exists
  Cross-device link
  Operation not supported by device
  Not a directory


$^E works similarly.

A better option might b e $@, which can be set to arbitrary error values.

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to