package err; use da qw(/.*/); use dbg qw(/.*/); use base qw(Error); use overload ('""' => 'stringify'); sub new { prtDbgSubInfo(); my ($pkg,$text) = @_; my @args = (); local $Error::Depth = $Error::Depth + 1; local $Error::Debug = 1; # Enables storing of stacktrace my ($this) = $pkg->SUPER::new(-text => $text, @args); my ($stack) = $this->stacktrace; $stack =~ s#$text #$text\n\t#; #adds a newline after the text and before the first at ... my ($preMsg) = "\n--Error--"; $this->{-text} = "$preMsg\n$stack"; return($this); }