The threads system is working properly and if you just remove the Win32 api it will work fine.
Ramy ----- Original Message ----- From: "Frazier, Joe Jr" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; "Glenn Linderman" <[EMAIL PROTECTED]> Cc: <perl-win32-gui-users@lists.sourceforge.net> Sent: Thursday, February 19, 2004 10:01 PM Subject: RE: [perl-win32-gui-users] New Win32 Package suggestion and sample code Ramy, I am fairly sure it is the Threads thing. This has been discussed on the list about 8-12 weeks ago or so(in regards to perlapp if I remember correctly.) I don't know if anyone has come up with a solution as of yet. > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of [EMAIL PROTECTED] > Sent: Thursday, February 19, 2004 2:47 PM > To: Glenn Linderman > Cc: perl-win32-gui-users@lists.sourceforge.net > Subject: Re: [perl-win32-gui-users] New Win32 Package > suggestion and sample code > > The code is below to test Win32::API with perl2exe: > > #========================================================== > $| = 1; > use CGI::Carp; > use Carp::Heavy; > #========================================================== > use threads; > use threads::shared; > use Thread::Running; > use LWP::UserAgent; > use attributes; > use WIn32::API; > share %Result; > share %Done; > #========================================================== > use Win32::GUI; > $MW = new Win32::GUI::Window( > -title => 'Test', > -left => 100, > -top => 100, > -width => 400, > -height => 200, > -name => 'MainWindow', > -visible => 1, > ); > > $PrintMsg = $MW->AddLabel( > -text => "Processing:", > -name => "ProcessingLabel", > -left => 30, > -top => 30, > -width => 290, > -height => 20, > -foreground => 0, > -visible=> 1, > ); > #---------------------------------------- > &StartThreads; > $MW->Show(); > Win32::GUI::Dialog; > #---------------------------------------- > sub MainWindow_Terminate { > return -1; > } > #========================================================== > sub StartThreads{ > my ($x, @x, @url); > > $x = 0; > undef @x; > > @url = ('http://search.cpan.org/', 'http://yahoo.com/', > 'http://mewsoft.com/', 'http://ayna.com/', 'http://arabikx.com/', > 'http://maktoob.com/', 'http://masrawy.com/', > 'http://ajeeb.com/', 'http://egypt.com/', 'http://search.com/'); > > undef %Thread; > undef %Done; > undef %Result; > > for $x(0..9) { > $y[0] = $x; > $y[1] = $url[$x]; > $Done{$x} = 2; > $Thread{$x} = threads->new(\&get_url, @y); > $Thread{$x}->detach(); > $PrintMsg->Text("Created thread $x..."); } > > #$Thread{0}->join; > #sleep 1 until threads->tojoin; > #while (! threads->tojoin) {print ".";sleep 1;} # This > created the error The memory can not be "read". > #$_->join foreach threads->tojoin; # join all joinable threads > > while (1) { > while (my($k, $v) = each %Done) { > if ($v==1) { > $PrintMsg->Text("Finished Thread $k..."); > delete $Done{$k}; > } > } > my $k = keys %Done; > > if (!$k) {last;} > Win32::GUI::DoEvents(); > }; > > $PrintMsg->Text("Finished All Threads..."); return 1; } > #========================================================== > sub get_url{ > my ($id, $url) = @_; > my ($text); > > my $ua = LWP::UserAgent->new; > my $response = $ua->get($url); > > if ($response->is_success) { > $text = $response->content; # or whatever > #print STDERR "Success URL: $url \n"; > } > else { > #print STDERR "Error URL: $url \n"; > $text = $response->status_line; > } > #return $text; > $Result{$id} = $text; > $Done{$id} = 1; > #return "$id\n"; > } > #========================================================== > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with a free > DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Perl-Win32-GUI-Users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > >