--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

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

--
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