line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Sys::OutPut.pm |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Little Output Utility |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# $Id: OutPut.pm,v 1.2 1998/01/19 03:56:49 aks Exp $ |
6
|
|
|
|
|
|
|
# $Source: /usr/cvsroot/perl/Sys-OutPut/OutPut.pm,v $ |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# I don't like to do "print STDERR" or "print STDOUT", so these |
9
|
|
|
|
|
|
|
# little routines do it for me. And, they take care of ensuring |
10
|
|
|
|
|
|
|
# that newlines are output when appropriate. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Sys::OutPut; |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
820
|
use Exporter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
480
|
|
15
|
|
|
|
|
|
|
@ISA = qw( Exporter ); |
16
|
|
|
|
|
|
|
@EXPORT = qw( talk out put err debug ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$quiet = defined($::quiet) ? $::quiet : '' unless defined($quiet); |
19
|
|
|
|
|
|
|
$debug = defined($::debug) ? $::debug : '' unless defined($debug); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub talk { |
22
|
4
|
100
|
|
4
|
0
|
18
|
&err(@_) unless $quiet; |
23
|
4
|
|
|
|
|
7
|
undef; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# out $FORMAT, $ARGS, ... |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub out { |
29
|
4
|
|
|
4
|
0
|
401
|
my $fmt = shift; |
30
|
4
|
100
|
|
|
|
10
|
$fmt = '' unless defined $fmt; # avoid undef refs |
31
|
4
|
|
|
|
|
6
|
my @args = @_; |
32
|
4
|
50
|
66
|
|
|
21
|
$fmt .= "\n" if $fmt eq '' || substr($fmt,-1) ne "\n"; |
33
|
4
|
|
|
|
|
64
|
printf STDOUT $fmt,@args; |
34
|
4
|
|
|
|
|
10
|
undef; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub put { |
38
|
2
|
|
|
2
|
0
|
10
|
printf STDOUT @_; |
39
|
2
|
|
|
|
|
4
|
undef; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub err { |
43
|
8
|
|
|
8
|
0
|
16
|
my $fmt = shift; |
44
|
8
|
50
|
|
|
|
14
|
$fmt = '' unless defined $fmt; # avoid undef refs |
45
|
8
|
|
|
|
|
10
|
my @args = @_; |
46
|
8
|
50
|
33
|
|
|
34
|
$fmt .= "\n" if $fmt eq '' || substr($fmt,-1) ne "\n"; |
47
|
8
|
|
|
|
|
120
|
printf STDERR $fmt,@args; |
48
|
8
|
|
|
|
|
12
|
undef; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub debug { |
52
|
3
|
100
|
|
3
|
0
|
14
|
return '' unless $debug; |
53
|
2
|
|
|
|
|
6
|
&err(@_); |
54
|
2
|
|
|
|
|
4
|
1; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |