16 |
$SIG{__WARN__} = sub { |
$SIG{__WARN__} = sub { |
17 |
return unless @_; |
return unless @_; |
18 |
my $msg = join('', @_); |
my $msg = join('', @_); |
19 |
if ( $msg !~ m{[\n\r]$} ) { |
if ( $msg =~ s{ line (\d+)\.}{ +$1} ) { |
20 |
my @loc = caller(1); |
$msg =~ s{^(.+)( at .+)}{\e[31m$1\e[0m$2} if $msg !~ m{^#}; |
|
$msg .= " in $loc[1] +$loc[2]\n" if @loc; |
|
21 |
} |
} |
22 |
$msg =~ s{\[(0|\d\d\d\d)\]}{ '[' . port2color($1) . ']' }eg; |
$msg =~ s{\[(0|\d\d\d\d)\]}{ '[' . port2color($1) . ']' }eg; |
23 |
print STDERR $msg unless $msg =~ m{^#} && ! $ENV{DEBUG}; |
print STDERR $msg unless $msg =~ m{^#} && ! $ENV{DEBUG}; |