Alternative warn and die for modules
The Carp routines are useful in your own modules because they act like
'die()' or 'warn()', but with a message which is more likely to be useful
to a user of your module. In the case of 'cluck()' and 'confess()', that
context is a summary of every call in the call-stack; 'longmess()' returns
the contents of the error message.
For a shorter message you can use 'carp()' or 'croak()' which report the
error as being from where your module was called. 'shortmess()' returns the
contents of this error message. There is no guarantee that that is where
the error was, but it is a good educated guess.
'Carp' takes care not to clobber the status variables '$!' and '$^E' in the
course of assembling its error messages. This means that a '$SIG{__DIE__}'
or '$SIG{__WARN__}' handler can capture the error information held in those
variables, if it is required to augment the error message, and if the code
calling 'Carp' left useful values there. Of course, 'Carp' can't guarantee
the latter.
You can also alter the way the output and logic of 'Carp' works, by
changing some global variables in the 'Carp' namespace. See the section on
'GLOBAL VARIABLES' below.
- Download package
-
Checkout Package
osc -A https://api.opensuse.org checkout home:computersalat:devel:perl/perl-Carp && cd $_
- Create Badge
Source Files
Filename | Size | Changed |
---|---|---|
Carp-1.33.tar.gz | 0000018639 18.2 KB | |
perl-Carp.changes | 0000000179 179 Bytes | |
perl-Carp.spec | 0000003424 3.34 KB |
Latest Revision
initial pkg 1.33
Comments 0