package PPM::Trace; use strict; use Exporter; our $VERSION = '3.00'; our @EXPORT_OK = qw(trace); our @ISA = qw(Exporter); my $trace_fh; # the filehandle my $trace_level = 0; sub trace_init { my $file = shift; $trace_level = shift; open ($trace_fh, '>>', $file) or die "Can't append $file: $!"; select((select($trace_fh), $| = 1)[0]); my $t = localtime; trace($trace_level, <= $lvl) { print $trace_fh @_; } 1; } END { trace_fini(); } 1;