#!/usr/local/bin/perl
use Tk;
# Main Window
$mw = new MainWindow;
$label = $mw -> Label(-text=>"Hello folks") -> pack();
$button = $mw -> Button(-text => "Click here to Flush rules",
-command =>\&flush) -> pack();
MainLoop;
sub flush {
$mw->messageBox(-message=>"Initiating flushing.. click on OK button");
system ("iptables -L");
system ("iptables -F");
system ("iptables -L");
}
I made this code and what it does is that when a user click on the Button a message box appears
Then when I click on OK button it calls the subroutine flush
and then the output is shown on terminal like this:
I want it to be appear on the same message box. How can I do it?