Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Perl/Tk + CSSH

by Monkless (Acolyte)
on Feb 08, 2012 at 10:08 UTC ( [id://952449]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl/Tk + CSSH
in thread Perl/Tk + CSSH

Ok, So I had the chance to review and here is what I have come up with. I took your example and mashed a chunk of my code that has my CSSH call, to see if I could manage the windows via example code.

#!/usr/bin/perl -w use warnings; use strict; use Tk; my ($x,$y,$count) = (0,0,0); my @systems = qw(system1 system2 system3 system4 system5 system7); foreach(@systems) { $count++; if (fork == 0) { #$widget->geometry("wxh+x+y") my $top = new MainWindow; $top->geometry('100x100'.'+'.$x.'+'.$y); $top => "cssh -G -T 'OOPCSSH' -l username $_"; ##MY PROBLEM LIES H +ERE. If I simply `the command/call` it runs but still no placement co +ntrol. $top->Button(-command => sub { warn "top$_" })->pack; MainLoop; CORE::exit(); } if( $count % 3 == 0) {$y += 150; $x = 0 } $x += 150; } MainLoop;

Since I am calling cssh, what it is actually doing is opening up a seperate XTERM window for each connection in which I can control each window with one control window. Essentially calling a seperate program all together, your example actually cleared up a previous issue I had but not quite this one, as I still cannot control the placement of the "outside" program/call. I would like to be able to place the XTERM windows that CSSH opens or use a CSSH module to do the work inside the program. Checking CPAN I didn't see what I was looking for.

Replies are listed 'Best First'.
Re^3: Perl/Tk + CSSH
by zentara (Archbishop) on Feb 08, 2012 at 10:37 UTC
    as I still cannot control the placement of the "outside" program/call. I would like to be able to place the XTERM windows that CSSH opens

    That can be done with the xterm options.

    See "xterm -h" for all the options. To execute cssh in that xterm, use the -e option, like " xterm -fn 10x20 -geometry '16x19+0+20' -e CSSH @CSSHOPTIONS "

    #!/usr/bin/perl use warnings; use strict; use Tk; my $mw = tkinit; $mw->Button(-text=>"Xterm",-command=> [\&go])->pack; $mw->Button(-text=>"Xterm with attributes ", -command=>[\&go, q(-fn 10x20 -geometry '16x19+0+20')])->pac +k; MainLoop; sub go { print "@_\n"; my $xoptions = shift || ''; local $SIG{CHLD} = 'IGNORE'; # don't wait for child # exit status. avoids # zombies. die "fork failed: $!" unless defined(my $pid = fork); return if $pid; exec("xterm $xoptions"); warn "exec failed: $!"; CORE::exit(1); }

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://952449]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-29 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found