line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!perl -w |
2
|
|
|
|
|
|
|
package D::oh; |
3
|
1
|
|
|
1
|
|
605
|
use vars qw(@ISA @EXPORT_OK @EXPORT $VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
97
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
5
|
use Exporter; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
46
|
|
6
|
1
|
|
|
1
|
|
6
|
use File::Basename; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
118
|
|
7
|
1
|
|
|
1
|
|
1160
|
use IO::Handle; |
|
1
|
|
|
|
|
9980
|
|
|
1
|
|
|
|
|
62
|
|
8
|
1
|
|
|
1
|
|
9
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
179
|
|
9
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
@EXPORT = (); |
11
|
|
|
|
|
|
|
@EXPORT_OK = qw(sortFile); |
12
|
|
|
|
|
|
|
$VERSION = sprintf("%d.%02d", q$Revision: 0.05 $ =~ /(\d+)\.(\d+)/); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#----------------------------------------------------------------- |
15
|
|
|
|
|
|
|
my($Sep) = (($^O eq 'MacOS') ? ':' : '/'); |
16
|
|
|
|
|
|
|
my($Err) = (($^O eq 'MacOS') ? "$ENV{TMPDIR}D\'oh" : '/tmp/D\'oh'); |
17
|
|
|
|
|
|
|
my($Out) = undef; |
18
|
|
|
|
|
|
|
#----------------------------------------------------------------- |
19
|
|
|
|
|
|
|
sub date { |
20
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
321
|
|
21
|
2
|
100
|
|
2
|
0
|
20
|
my($fh) = ($_[0] =~ /^STDOUT$/i ? 'STDOUT' : 'STDERR'); |
22
|
2
|
|
|
|
|
421
|
printf $fh "\n#===== %s [$$]: %s =====#\n", |
23
|
|
|
|
|
|
|
($0 =~ /([^$Sep]+)$/), scalar localtime; |
24
|
2
|
|
|
|
|
9
|
1; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
#----------------------------------------------------------------- |
27
|
|
|
|
|
|
|
sub stdout { |
28
|
1
|
0
|
|
1
|
0
|
98
|
$Out = $_[0] ? $_[0] : ($Out ? $Out : $Err); |
|
|
50
|
|
|
|
|
|
29
|
1
|
50
|
|
|
|
146
|
open(STDOUT,">>$Out") || croak("D'oh can't open $Err: $!"); |
30
|
1
|
|
|
|
|
16
|
STDOUT->autoflush(1); |
31
|
1
|
|
|
|
|
61
|
1; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
#----------------------------------------------------------------- |
34
|
|
|
|
|
|
|
sub stderr { |
35
|
1
|
50
|
|
1
|
0
|
22
|
$Err = $_[0] ? $_[0] : $Err; |
36
|
1
|
50
|
|
|
|
516
|
open(STDERR,">>$Err") || croak("D'oh can't open $Err: $!"); |
37
|
1
|
|
|
|
|
10
|
STDERR->autoflush(1); |
38
|
1
|
|
|
|
|
40
|
1; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
#----------------------------------------------------------------- |
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |