>>>>> "Dan" == Dan Muey <[EMAIL PROTECTED]> writes:
>> 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 -Ken Dan> Did anyone ever reply to this post? I couldn't find it in Dan> the archives and I thinnk it's a pretty good question. Dan> For instance would it be 'safe' and 'proper', and 'ok', Dan> etc... to do somethign like: Dan> sub whatever { my $foo = shift; undef $!; if($foo eq 'bar') { Dan> return 1; } else { $! = "Foo must equal bar";return 0; } } $! is for system-call-related errors that can be mapped to errno return values. I don't see "Foo must equal bar" fits that definition. Perhaps you want to look at the "Exception" module. Having said that, you can set $! to a numeric value, and it'll return that number in a numeric context, and the appropriate error text in a string context. Rememeber that $! is just a thin wrapper over errno though, so any system-call-related activity will change it. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>