Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Perl Tk nonblocking

by tybalt89 (Monsignor)
on Dec 01, 2016 at 00:54 UTC ( [id://1177002]=note: print w/replies, xml ) Need Help??


in reply to Perl Tk nonblocking

Try this one. I don't have nmap so I used something else that would produce output.

#!/usr/bin/perl # http://perlmonks.org/?node_id=1176994 use strict; use warnings; use Tk; use Tk::IO; my $tester; my $mw = MainWindow->new; my $b1 = $mw->Button(-text => 'Go', -command => \&go)->pack(); my $b2 = $mw->Button(-text => 'Exit', -command => sub{exit} )->pack(); my $text = $mw->Scrolled('Text',-scrollbars=>'e')->pack; MainLoop; sub go { $tester = Tk::IO->new( -linecommand => sub {$text->insert('end', shift()) }, ); $tester->exec('ls -l | head'); # command goes in here }

Replies are listed 'Best First'.
Re^2: Perl Tk nonblocking
by rjbuckley (Novice) on Dec 01, 2016 at 09:14 UTC

    Thanks tybalt89, your solution worked

Log In?
Username:
Password:

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

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

    No recent polls found