Ken Lehman wrote: > I want to be able to return a true or false value from a function in a > module and populate the $! variable with the specific errors. Is this > possible? Is there documentation on how to do this? I can find docs on how > to use $! but not how to set it. Thanks for any help
$! is tied to errno which is basically (usually) an interger set by the system calls in case of an error. it's defined by the ISO C standard. you can't set errno to an arbitrary number or string and expect the it to work. check 'man errno' for a full discussion. you can check your system's errno.h to see values are defined for errno. for example, in my linux box: [panda]# more /usr/include/asm/errno.h ... #define ENOTBLK 15 /* Block device required */ #define EBUSY 16 /* Device or resource busy */ #define EEXIST 17 /* File exists */ ... you can then assign $! like: [panda]# perl -MErrno=:POSIX -le '$!=ENOTDIR; print $!+0,": ",$!' 20: Not a directory mess with errno only when you really need to! david -- sub'_{print"@_ ";* \ = * __ ,\ & \} sub'__{print"@_ ";* \ = * ___ ,\ & \} sub'___{print"@_ ";* \ = * ____ ,\ & \} sub'____{print"@_,\n"}&{_+Just}(another)->(Perl)->(Hacker) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>