Here's an example of Tk::IO

You'll have to write a separate perl program to fetch URLs. In this example I faked that part with a simple shell script just as a proof of concept.

#!/usr/bin/perl # https://perlmonks.org/?node_id=1227829 use strict; use warnings; use Tk; use Tk::IO; use Tk::ROText; my (@data1, @data2, @data3, @data4); my $complete1 = my $complete2 = my $complete3 = my $complete4 = 0; my $status = 'Ready to Start'; my $mw = MainWindow->new; $mw->Button(-text => 'Load', -command => \&startload, )->pack; $mw->Label(-textvariable => \$status, )->pack; $mw->Button(-text => 'Exit', -command => sub{$mw->destroy}, )->pack(-side => 'bottom'); $_ = $mw->ROText( -width => 40, )->pack(-side => 'left') for my ($t1, $t2, $t3, $t4); MainLoop; sub startload { $status = 'Started'; child( \@data1, \$complete1, 'one', 'sleep 1; echo data one', $t1 ); child( \@data2, \$complete2, 'two', 'sleep 3; echo data two', $t2 ); child( \@data3, \$complete3, 'three', 'sleep 4; echo data three', $t +3 ); child( \@data4, \$complete4, 'four', 'sleep 2; echo data four', $t4 +); } sub common { $complete1 && $complete2 && $complete3 && $complete4 or return; $status = 'All Completed'; # do final processing here ##################### } sub child { my ($refdata, $refcomplete, $message, $command, $rotext) = @_; @$refdata = (); $$refcomplete = 0; $rotext->delete('1.0' => 'end'); Tk::IO->new( -linecommand => sub {push @$refdata, shift}, -childcommand => sub { $$refcomplete = 1; $status = "$message completed"; $rotext->insert(end => join '', @$refdata); common(); }, )->exec($command); }

There are a couple other examples of Tk::IO on this site, you can search for them if you want.


In reply to Re^3: Parallel download Tk by tybalt89
in thread Parallel download Tk by Takamoto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.