line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package IPC::ShellCmd::Generic; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1231
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
4
|
1
|
|
|
1
|
|
5
|
use Carp qw(croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
82
|
|
5
|
1
|
|
|
1
|
|
5
|
use base qw(IPC::ShellCmd::ShBase); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
579
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
IPC::ShellCmd::Generic - Chain a generic wrapper-type command |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$cmd_obj->chain_prog( |
14
|
|
|
|
|
|
|
IPC::ShellCmd::Generic->new( |
15
|
|
|
|
|
|
|
Prog => 'time', |
16
|
|
|
|
|
|
|
Args => ["-p"], |
17
|
|
|
|
|
|
|
) |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head2 IPC::ShellCmd::Generic->B(Prog => I<$prog>, [I<$opt> => I<$val>, ...]) |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
The only external method for this is the constructor. This sets up the |
26
|
|
|
|
|
|
|
various arguments that are going to be used to generate the command-line. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Other methods on this are used by L, but it should only ever be |
29
|
|
|
|
|
|
|
used inside of the B method on a L object. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=over 4 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=item B I |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
The program to run, eg. tsocks, socksify, time |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item B |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
A set of arguments to the program before passing the command and args |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=back |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new { |
46
|
0
|
|
|
0
|
1
|
|
my $package = shift; |
47
|
0
|
|
|
|
|
|
my %args = @_; |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
croak "Must specify a Prog argument" |
50
|
|
|
|
|
|
|
unless defined $args{Prog}; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $self = bless { args => \%args }, $package; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return $self; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub chain { |
58
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
59
|
0
|
|
|
|
|
|
my $cmd = shift; |
60
|
0
|
|
|
|
|
|
my $args = shift; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $cmd_string = $self->generate_sh_cmd($cmd, $args); |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my @generic = ($self->{args}->{Prog}); |
65
|
|
|
|
|
|
|
|
66
|
0
|
0
|
|
|
|
|
push (@generic, @{$self->{args}->{Args}}) |
|
0
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
if(defined $self->{args}->{Args}); |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
push (@generic, "sh", "-c", $cmd_string); |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return @generic; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 BUGS |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
I don't know of any, but that doesn't mean they're not there. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHORS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
See L for authors. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 LICENSE |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
See L for the license. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |