From 78c71b5960a514c55aa5ab09a1e777fee68146fb Mon Sep 17 00:00:00 2001 From: Duncan Ferguson Date: Wed, 31 Aug 2011 21:12:49 +0100 Subject: [PATCH] Move potential new helper code into the helper module --- lib/App/ClusterSSH.pm | 108 ----------------------------------- lib/App/ClusterSSH/Helper.pm | 51 +++++++++++++++++ 2 files changed, 51 insertions(+), 108 deletions(-) diff --git a/lib/App/ClusterSSH.pm b/lib/App/ClusterSSH.pm index 8d3a249..cc8102a 100644 --- a/lib/App/ClusterSSH.pm +++ b/lib/App/ClusterSSH.pm @@ -740,114 +740,6 @@ sub send_resizemove($$$$$) { #$xdisplay->flush(); # dont flush here, but after all tiling worked out } -#sub setup_helper_script() { -# my($self) = @_; -# logmsg( 2, "Setting up helper script" ); -# my $comms=$self->config->{comms}; -# my $comms_args=$self->config->{$self->config->{comms}.'_args'} || ''; -# my $command=$self->config->{command}; -# -# # 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); -# }; -## $helper_script = <<" HERE"; -## my \$pipe=shift; -## my \$svr=shift; -## my \$user=shift; -## my \$port=shift; -## my \$mstr=shift; -## my \$command="$config{$config{comms}} $config{$config{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("$config{comms}" ne "console") { -## \$mstr = \$mstr ? "-M \$mstr " : ""; -## \$command .= \$mstr; -## } -## } -## if(\$user) { -## unless("$config{comms}" eq "telnet") { -## \$user = \$user ? "-l \$user " : ""; -## \$command .= \$user; -## } -## } -## if("$config{comms}" eq "telnet") { -## \$command .= "\$svr \$port"; -## } else { -## if (\$port) { -## \$command .= "-p \$port \$svr"; -## } else { -## \$command .= "\$svr"; -## } -## } -## \$command .= " $config{command} || sleep 5"; -### warn("Running:\$command\\n"); # for debug purposes -## exec(\$command); -## HERE -# -# # eval $helper_script || die ($@); # for debug purposes -# #logmsg( 2, $helper_script ); -# #logmsg( 2, "Helper script done" ); -# -# return $self; -#} - sub open_client_windows(@) { my $self = shift; foreach (@_) { diff --git a/lib/App/ClusterSSH/Helper.pm b/lib/App/ClusterSSH/Helper.pm index c380a0e..05376bc 100644 --- a/lib/App/ClusterSSH/Helper.pm +++ b/lib/App/ClusterSSH/Helper.pm @@ -26,6 +26,57 @@ sub script { my $comms_args = $config->{$comms.'_args'}; my $command = $config->{command}; +# # 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;