| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Shell::Verbose; |
|
2
|
1
|
|
|
1
|
|
42432
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
32
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
102
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Shell::Verbose - A verbose version of system() |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use Shell::Verbose qw/verboseSystem vsys/; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
verboseSystem('echo "foo"'); |
|
14
|
|
|
|
|
|
|
# echo "foo" |
|
15
|
|
|
|
|
|
|
# foo |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
vsys('echo "foo"'); |
|
18
|
|
|
|
|
|
|
# echo "foo" |
|
19
|
|
|
|
|
|
|
# foo |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Shell::Verbose->prefix('===> '); |
|
22
|
|
|
|
|
|
|
# ===> echo 'foo' |
|
23
|
|
|
|
|
|
|
# foo |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Shell::Verbose->before('Running the next line'); |
|
26
|
|
|
|
|
|
|
# Running the next line |
|
27
|
|
|
|
|
|
|
# ===> echo 'foo' |
|
28
|
|
|
|
|
|
|
# foo |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Shell::Verbose->after('That was easy'); |
|
31
|
|
|
|
|
|
|
# Running the next line |
|
32
|
|
|
|
|
|
|
# ===> echo 'foo' |
|
33
|
|
|
|
|
|
|
# foo |
|
34
|
|
|
|
|
|
|
# That was easy |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
A simple wrapper for system() that prints the command |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 AUTHOR |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Drew Stephens |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
our ($VERSION, @ISA, @EXPORT_OK); |
|
47
|
|
|
|
|
|
|
BEGIN { |
|
48
|
1
|
|
|
1
|
|
2
|
$VERSION = '0.1.1'; |
|
49
|
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
4
|
require Exporter; |
|
51
|
1
|
|
|
|
|
8
|
@ISA = qw/Exporter/; |
|
52
|
1
|
|
|
|
|
213
|
@EXPORT_OK = qw/verboseSystem vsys/; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $prefix = ''; |
|
56
|
|
|
|
|
|
|
my $before = ''; |
|
57
|
|
|
|
|
|
|
my $after = ''; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub prefix { |
|
60
|
2
|
|
|
2
|
0
|
2864
|
shift; |
|
61
|
2
|
|
|
|
|
10
|
$prefix = shift; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub before { |
|
65
|
2
|
|
|
2
|
0
|
1212
|
shift; |
|
66
|
2
|
|
|
|
|
7
|
$before = shift; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub after { |
|
70
|
2
|
|
|
2
|
0
|
991
|
shift; |
|
71
|
2
|
|
|
|
|
59
|
$before = shift; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub verboseSystem { |
|
75
|
5
|
|
|
5
|
0
|
1312
|
my $command = shift; |
|
76
|
|
|
|
|
|
|
|
|
77
|
5
|
100
|
|
|
|
81
|
print "$before\n" if ($before); |
|
78
|
5
|
|
|
|
|
128
|
print $prefix . $command . "\n"; |
|
79
|
5
|
|
|
|
|
10691
|
my $ret = (system($command) == 0); |
|
80
|
5
|
50
|
|
|
|
35
|
print "$after\n" if ($after); |
|
81
|
5
|
|
|
|
|
131
|
return $ret; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub vsys { |
|
85
|
4
|
|
|
4
|
0
|
5129
|
verboseSystem(@_); |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |