| 1 | |||
| 2 | package App::FQStat::Debug; | ||
| 3 | # App::FQStat is (c) 2007-2009 Steffen Mueller | ||
| 4 | # | ||
| 5 | # This program is free software; you can redistribute it and/or | ||
| 6 | # modify it under the same terms as Perl itself. | ||
| 7 | |||
| 8 | use strict; | ||
| 9 | use warnings; | ||
| 10 | use Time::HiRes qw/time/; | ||
| 11 | use App::FQStat::Debug; | ||
| 12 | |||
| 13 | use base 'Exporter'; | ||
| 14 | our %EXPORT_TAGS = ( | ||
| 15 | 'all' => [qw( | ||
| 16 | warnline | ||
| 17 | warnenter | ||
| 18 | )], | ||
| 19 | ); | ||
| 20 | our @EXPORT_OK = @{$EXPORT_TAGS{'all'}}; | ||
| 21 | our @EXPORT = @{$EXPORT_TAGS{'all'}}; | ||
| 22 | |||
| 23 | sub warnline ($) { | ||
| 24 | my $msg = shift; | ||
| 25 | chomp($msg); | ||
| 26 | my $time = time(); | ||
| 27 | my ($pkg, $file, $line) = caller(); | ||
| 28 | ::debug( sprintf("[% 6.2f]", $time - &::STARTTIME()) . " $msg at $file line $line\n" ); | ||
| 29 | } | ||
| 30 | |||
| 31 | sub warnenter () { | ||
| 32 | my $time = time(); | ||
| 33 | my ($fpkg, $ffile, $fline, $sub) = caller(1); | ||
| 34 | ::debug( sprintf("[% 6.2f]", $time - &::STARTTIME()) . " Entering $sub from $ffile line $fline\n" ); | ||
| 35 | } | ||
| 36 | |||
| 37 | 1; | ||
| 38 |