mailmeakhila has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::Pane; use WWW::Mechanize; use Web::Scraper; use Data::Dumper; use Parallel::ForkManager; my $mw = tkinit(); $mw->geometry('300x300+100+100'); my $sp = $mw->Scrolled('Pane',-scrollbars=>'osoe',sticky=>'nwse')->pac +k(-expand=>1,-fill=>'both'); $sp->Label(-text=>"Give Keyword file")->pack(); my $entry1 = $sp->Entry()->pack(); my $showbutton = $mw->Button(-text=>'Submit', -command =>\&button_callback)->pack(); my $bimage = scraper { process "img" , "url[]" => '@src'; }; sub button_callback { my $filename = $entry1->get(); open FH, $filename or die $!; my $mech = WWW::Mechanize->new; my $manager = new Parallel::ForkManager(10); while (my $line = <FH>) { $manager->start and next; chomp($line); my @temp = split(/ /,$line); my $query = join('+',@tem +p); my $ibing = "http://www.bing.com/images/search?count=10&q=".$query; $mech->get($ibing); #print Dumper $mech->content; my $res = $bimage->scrape($mech->content,$mech->uri); print Dumper $res; $manager->finish; $manager->wait_all_children; } close (FH); } MainLoop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help in using threads in Tk
by nikosv (Deacon) on Apr 27, 2012 at 05:47 UTC | |
|
Re: Need help in using threads in Tk
by zentara (Cardinal) on Apr 27, 2012 at 10:14 UTC | |
by mailmeakhila (Sexton) on Apr 27, 2012 at 19:48 UTC | |
by zentara (Cardinal) on Apr 28, 2012 at 11:29 UTC | |
|
Re: Need help in using threads in Tk
by Anonymous Monk on Apr 27, 2012 at 05:29 UTC |