Hi, will someone help me? I am totally new for program and Perl, and I made a small tool for myself to download some files required cookies config. Now I want to add the threads in the tool for free of "no responding", and I tried my best but failed after I read some involved info like "perldoc threads" (pod and online), and many codes. So will someone help me, I know it's easy, but it's my first step. Additionally, I want to know how to let the entry or other widgets support the right button of the mouse under Windows? Thank you so much Best regards
######### test.pl #!/usr/bin/perl use strict; use warnings; use Tk; use LWP::UserAgent; my @headers; my $mw = MainWindow->new(); $mw->resizable( 0,0 ); $mw->title("test"); my $frame = $mw->Frame(-borderwidth => 2,-relief => 'groove')->pack(); $mw->Button(-text => "Down",-command => \&d)->pack(-side => 'left'); my $cks; $frame->Label(-text => 'Cookies:')->pack(); my $cks_enter = $frame->Entry(-textvariable => \$cks,-width => 50)->pa +ck(); my $url; $frame->Label(-text => 'URL:')->pack(); my $url_enter = $frame->Entry(-textvariable => \$url)->pack(-expand => + 1, -fill => 'x'); my $filename; $frame->Label(-text => 'Filename:')->pack(); my $fnm_enter = $frame->Entry(-textvariable => \$filename)->pack(-expa +nd => 1, -fill => 'x'); MainLoop; sub d { $cks = $cks_enter->get(); chomp($cks); $url = $url_enter->get(); chomp($url); $filename = $fnm_enter->get(); chomp($filename); @headers = ( 'User-Agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; EN; rv:1. +9.0.11) Gecko/2009060215 Firefox/3.5', 'cookie' => "$cks", ); my $ua = LWP::UserAgent->new(); my $req = $ua->get($url,@headers); my $cont = $req->content; open PIC, ">$filename"; binmode(PIC); print PIC "$cont\n"; close PIC; }

In reply to Threads problem with Tk by go0913

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.