#!/usr/bin/env perl use strict; use warnings; use autodie qw{:all}; use Tk; my $mw = MainWindow::->new(); $mw->Label(-text => 'Embedded slave:')->pack; if (length $ARGV[0]) { my $slave_frame = $mw->Frame(-container => 1)->pack; my $container_id = $slave_frame->id; open my $pipe, '-|', "$ARGV[0] $container_id"; MainLoop; close $pipe; } else { my $slave_frame = $mw->Frame()->pack; $slave_frame->Label(-text => 'No slave supplied!')->pack; MainLoop; }