/usr/share/perl5/App/ClusterSSH/Helper.pm is in clusterssh 4.01.01-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | package App::ClusterSSH::Helper;
use strict;
use warnings;
use version;
our $VERSION = version->new('0.01');
use Carp;
use Try::Tiny;
use base qw/ App::ClusterSSH::Base /;
sub new {
my ( $class, %args ) = @_;
my $self = $class->SUPER::new(%args);
return $self;
}
sub script {
my ($self, $config ) = @_;
my $comms = $config->{comms};
my $comms_args = $config->{$comms.'_args'};
my $command = $config->{command};
my $autoclose = $config->{auto_close};
my $postcommand = $autoclose ? "echo Press RETURN to continue; read IGNORE" : "sleep $autoclose";
# # P = pipe file
# # s = server
# # u = username
# # p = port
# # m = ccon master
# # c = comms command
# # a = command args
# # C = command to run
# my $lelehelper_script = q{
# use strict;
# use warnings;
# use Getopt::Std;
# my %opts;
# getopts('PsupmcaC', \%opts);
# my $command="$opts{c} $opts{a}";
# open(PIPE, ">", $opts{P}) or die("Failed to open pipe: $!\n");
# print PIPE "$$:$ENV{WINDOWID}"
# or die("Failed to write to pipe: $!\\n");
# close(PIPE) or die("Failed to close pipe: $!\\n");
# if($opts{s} =~ m/==$/)
# {
# $opts{s} =~ s/==$//;
# warn("\nWARNING: failed to resolve IP address for $opts{s}.\n\n");
# sleep 5;
# }
# if($opts{m}) {
# unless("$comms" ne "console") {
# $opts{m} = $opts{m} ? "-M $opts{m} " : "";
# $opts{c} .= $opts{m};
# }
# }
# if($opts{u}) {
# unless("$comms" eq "telnet") {
# $opts{u} = $opts{u} ? "-l $opts{u} " : "";
# $opts{c} .= $opts{u};
# }
# }
# if("$comms" eq "telnet") {
# $command .= "$opts{s} $opts{p}";
# } else {
# if ($opts{p}) {
# $opts{c} .= "-p $opts{p} $opts{s}";
# } else {
# $opts{c} .= "$opts{s}";
# }
# }
# #$command .= " $command || sleep 5";
# warn("Running:$command\n"); # for debug purposes
# exec($command);
# };
my $script = <<" HERE";
my \$pipe=shift;
my \$svr=shift;
my \$user=shift;
my \$port=shift;
my \$mstr=shift;
my \$command="$comms $comms_args ";
open(PIPE, ">", \$pipe) or die("Failed to open pipe: \$!\\n");
print PIPE "\$\$:\$ENV{WINDOWID}"
or die("Failed to write to pipe: $!\\n");
close(PIPE) or die("Failed to close pipe: $!\\n");
if(\$svr =~ m/==\$/)
{
\$svr =~ s/==\$//;
warn("\\nWARNING: failed to resolve IP address for \$svr.\\n\\n"
);
sleep 5;
}
if(\$mstr) {
unless("$comms" ne "console") {
\$mstr = \$mstr ? "-M \$mstr " : "";
\$command .= \$mstr;
}
}
if(\$user) {
unless("$comms" eq "telnet") {
\$user = \$user ? "-l \$user " : "";
\$command .= \$user;
}
}
if("$comms" eq "telnet") {
\$command .= "\$svr \$port";
} else {
if (\$port) {
\$command .= "-p \$port \$svr";
} else {
\$command .= "\$svr";
}
}
\$command .= " \\\"$command\\\" ; $postcommand";
warn("Running:\$command\\n"); # for debug purposes
exec(\$command);
HERE
$self->debug(4, $script);
$self->debug(2, 'Helper script done');
return $script;
}
#use overload (
# q{""} => sub {
# my ($self) = @_;
# return $self->{hostname};
# },
# fallback => 1,
#);
1;
=pod
=head1 NAME
ClusterSSH::Helper - Object representing application configuration
=head1 SYNOPSIS
=head1 DESCRIPTION
Object representing application configuration
=head1 METHODS
=over 4
=item $host=ClusterSSH::Helper->new ({ })
Create a new helper object.
=item $host=ClusterSSH::Helper->script ({ })
Return the helper script
=back
=head1 AUTHOR
Duncan Ferguson, C<< <duncan_j_ferguson at yahoo.co.uk> >>
=head1 LICENSE AND COPYRIGHT
Copyright 1999-2010 Duncan Ferguson.
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
=cut
1;
|