Search notes:

Perl function: die

Signal handler for die

#!/usr/bin/perl
use warnings;
use strict;

$SIG{__DIE__} = sub {
   print("The programm died: @_");
   exit(-1);
};


for my $word ( qw( foo bar bla baz ) ) {

   unless ($word eq 'foo' or $word eq 'bar' or $word eq 'baz') {
     die "word $word was found";
   }
   print "word is $word\n";

}
Github repository about-perl, path: /functions/die/SIG.pl

Using croak rather than die in modules

Within perl modules, croak is a better die.

See also

Perl functions

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758207259, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Perl/functions/die(63): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78