| 1 | #!perl -w | ||||||||||||||
| 2 | package D::oh; | ||||||||||||||
| 3 | 1 | ▶ | use vars qw(@ISA @EXPORT_OK @EXPORT $VERSION); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 1 | ▶ | use Exporter; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | 1 | ▶ | use File::Basename; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | 1 | ▶ | use IO::Handle; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | 1 | ▶ | use Carp; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | 1 | @ISA = qw(Exporter); | |||||||||||||
| 10 | 1 | @EXPORT = (); | |||||||||||||
| 11 | 1 | @EXPORT_OK = qw(sortFile); | |||||||||||||
| 12 | 1 | $VERSION = sprintf("%d.%02d", q$Revision: 0.05 $ =~ /(\d+)\.(\d+)/); | |||||||||||||
| 13 | |||||||||||||||
| 14 | #----------------------------------------------------------------- | ||||||||||||||
| 15 | 1 | ▶ | my($Sep) = (($^O eq 'MacOS') ? ':' : '/'); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 16 | 1 | ▶ | my($Err) = (($^O eq 'MacOS') ? "$ENV{TMPDIR}D\'oh" : '/tmp/D\'oh'); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 17 | 1 | my($Out) = undef; | |||||||||||||
| 18 | #----------------------------------------------------------------- | ||||||||||||||
| 19 | sub date { | ||||||||||||||
| 20 | 1 | ▶ | no strict 'refs'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 21 | 2 | ▶ | my($fh) = ($_[0] =~ /^STDOUT$/i ? 'STDOUT' : 'STDERR'); | ||||||||||||
|
Subroutine
date: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||
| 22 | 2 | printf $fh "\n#===== %s [$$]: %s =====#\n", | |||||||||||||
| 23 | ($0 =~ /([^$Sep]+)$/), scalar localtime; | ||||||||||||||
| 24 | 2 | 1; | |||||||||||||
| 25 | } | ||||||||||||||
| 26 | #----------------------------------------------------------------- | ||||||||||||||
| 27 | sub stdout { | ||||||||||||||
| 28 | 1 | ▶ | $Out = $_[0] ? $_[0] : ($Out ? $Out : $Err); | ||||||||||||
|
Subroutine
stdout: called CC=4 SCAR=16.1
Pod
undocumented
Branch: 2 branches
| |||||||||||||||
| 29 | 1 | ▶ | open(STDOUT,">>$Out") || croak("D'oh can't open $Err: $!"); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 30 | 1 | STDOUT->autoflush(1); | |||||||||||||
| 31 | 1 | 1; | |||||||||||||
| 32 | } | ||||||||||||||
| 33 | #----------------------------------------------------------------- | ||||||||||||||
| 34 | sub stderr { | ||||||||||||||
| 35 | 1 | ▶ | $Err = $_[0] ? $_[0] : $Err; | ||||||||||||
|
Subroutine
stderr: called CC=3 SCAR=11.4
Pod
undocumented
Branch: 1 branch
| |||||||||||||||
| 36 | 1 | ▶ | open(STDERR,">>$Err") || croak("D'oh can't open $Err: $!"); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 37 | 1 | STDERR->autoflush(1); | |||||||||||||
| 38 | 1 | 1; | |||||||||||||
| 39 | } | ||||||||||||||
| 40 | #----------------------------------------------------------------- | ||||||||||||||
| 41 | 1 | 1; | |||||||||||||
| 42 | |||||||||||||||
| 43 | __END__ | ||||||||||||||