From: "Dan Muey" <[EMAIL PROTECTED]>
> I'm writing a simple module to return a few variables and functions.
>
> The perldoc perlmod* stuff says I should use Carp; and call that
> instead of warn(). So.. 1) If I use Carp shoud I still use warnings;
> in the package?
Definitely. "use Carp" and "use warnings" are not as related as it
may seem. "use warnings" is a pragma that controls the warnings
issued by Perl itself, and "use Carp" allows you to issue a warning
(or die) from perspective of caller. That is the message will contain
the filename and line number of the call to your function, not of
some line in the function itself.
> 2) If I understand it correctly the preffered way
> would be to do:
>
> use Carp;
> ...
> carp("Watch your monkey");
>
> Instead of:
> ...
> warn("Watch your monkey");
Depends. If you want to say the user of your module did something you
don't like you should use carp(), if you fail doing somethig you
should warn().
Depends on where do you want the "user" of your module to look.
> 3)
> Should I just do
>
> use Carp(carp);
> Since I'll only be calling carp() ( assuming carp() is warn()'s
> replacement in Carp.pm )
I guess you mean
use Carp qw(carp);
yes, you may do that.
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]