Dan Muey 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 -Ken
>
> Did anyone ever reply to this post?

Yes.  There was actually an extensive thread.

>
> I couldn't find it in the archives and I thinnk it's a pretty good question.
>
> For instance would it be 'safe' and 'proper', and 'ok', etc... to do somethign like:
>
> sub whatever {
>         my $foo = shift;
>         undef $!;
>         if($foo eq 'bar') { return 1; }
>         else { $! = "Foo must equal bar";return 0; }
> }
>
> TIA
>
> Dan

I agree that a close localization can be relatively harmless, maybe even useful.  Still
I would not recommend getting into the habit, since it could mask much more valuable
information from the interpreter, and since there are tons of other ways to communicate
custom errors.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to