> --As off Monday, December 29, 2003 12:54 PM -0600, Dan Muey is
> alleged to have said:
>
> >> 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?
> > I couldn't find it in the archives and I thinnk it's a pretty good
> > question.
>
> There were several responses, I can forward them to you if you really
> want them. Basically it boiled down to: "Read 'perldoc perlvar' for
> how and possible values.", and "Are you sure you want to do that?".
>
> > 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; }
> > }
>
> "Foo must equal bar" is not a valid value for $!, most likely. :-)
> For what you are doing here I would really prefer you either 'die' or
> 'warn', depending on what severity you think the problem is. (You
> could of course 'croak' or 'carp' instead, as applicable.)
>
> Daniel T. Staal
I'll probably just do something else besides setting it. If I
must have a variable then I can just have my own little $error
variable to use fo rthat purpose. Thanks for the offer to forward them,
I'll just look at the perldoc and go from there.
Thanks
Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>