summaryrefslogtreecommitdiffstats
path: root/lib/Carp/Always/Color/Term.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Carp/Always/Color/Term.pm')
-rw-r--r--lib/Carp/Always/Color/Term.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Carp/Always/Color/Term.pm b/lib/Carp/Always/Color/Term.pm
index c4789f6..579eb5c 100644
--- a/lib/Carp/Always/Color/Term.pm
+++ b/lib/Carp/Always/Color/Term.pm
@@ -23,20 +23,21 @@ of where STDERR is pointing to.
BEGIN { $Carp::Internal{(__PACKAGE__)}++ }
sub _die {
+ die @_ if ref($_[0]);
eval { Carp::Always::_die(@_) };
my $err = $@;
- $err =~ s/(.*)/\e[31m$1\e[m/;
+ $err =~ s/(.*)( at .*? line .*?$)/\e[31m$1\e[m$2/m;
die $err;
}
sub _warn {
- my $warning;
+ my @warning;
{
- local $SIG{__WARN__} = sub { $warning = $_[0] };
+ local $SIG{__WARN__} = sub { @warning = @_ };
Carp::Always::_warn(@_);
}
- $warning =~ s/(.*)/\e[33m$1\e[m/;
- warn $warning;
+ $warning[0] =~ s/(.*)( at .*? line .*?$)/\e[33m$1\e[m$2/m;
+ warn @warning;
}
my %OLD_SIG;