Current Path :
/
opt
/
cpanel
/
perl5
/
514
/
site_lib
/
Devel
/
Or
Select Your Path :
Upload File :
New :
File
Dir
//opt/cpanel/perl5/514/site_lib/Devel/MyTrace.pm
package MyTrace; use strict; use warnings; use Carp; #use v5.10; # perl -d:MyTrace program.pl my %seen; $|=1; BEGIN { my $trace_file = $ENV{TRACE_FILE} || "STDERR"; print STDERR "Saving trace to $trace_file\n"; my $fh = do { if ( $trace_file eq '-' ) { \*STDOUT } elsif ( $trace_file eq 'STDERR' ) { \*STDERR } else { open my $fh, '>>', $trace_file; $fh; } }; sub DB::DB { my( $package, $file, $line ) = caller; # only display debut for current script calls unless ($ENV{FULLTRACE}) { return unless $file eq $0; } return if $file =~ qr{/warnings\.pm}; return if $file =~ qr{/Carp\.pm}; return if $file =~ qr{/warnings/}; return if $file =~ qr{/overload.pm}; return if $file =~ /Test\/Builder\.pm$/; return if $file =~ /Test\/More\.pm$/; return if $file =~ /Cpanel\/Logger\.pm$/; if ( $ENV{CPANELTRACE} ) { # only want Cpanel modules warn $file unless $seen{$file}++; #return unless $file =~ /Cpanel/ or $file eq $0; # do not want this noise #return if $file =~ /Cpanel\/Class/; } my $code; { no strict 'refs'; $code = \@{"::_<$file"}; } print $fh "[@{[time]}] $file $line $code->[$line]"; } }; 1;