use strict; use warnings; package DB::DBException; use base qw(Error); sub new { my ($sClass, $msg) = @_; my @args = (); local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; # Enables storing of stacktrace # *** this is the key line change *** my $self = $sClass->SUPER::new(-text => $msg, @args); return $self; }