Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
The croak Function in Perl
The croak function in Perl is equivalent to die, except that it reports the caller one level up. Like die, this function also exits the script after reporting the error to STDERR −
package T;
require Exporter;
@ISA = qw/Exporter/;
@EXPORT = qw/function/;
use Carp;
sub function {
croak "Error in module!";
}
1;
When called from a script like below −
use T; function();
It will produce the following result −
Error in module! at test.pl line 4
As with carp, the same basic rules apply regarding the including of line and file information according to the warn and die functions.
Advertisements
