in reply to Not geting Shared variable of parent process into the thread
Is this running at all for you? because I've identified a bunch of syntax errors, you might want to use use strict; and use warnings; in your code that will help you diagnosing and understanding
Here is what I've found:
If this is your first experience with Perl, I'd recommend you to start from basic stuff, since when you working with threads there is a high probability things screw up and you don't know where, bottom line is "..you have to learn to crawl before you learn to walk ..." (Aerosmith)
Usefull links:
Finally here is your code corrected
use strict; use warnings; use threads; use threads::shared; use APP::Plugin; use Data::Dumper; my %hsh : shared = ( 'a' => 1 ); my $thread = threads->create( \&subrt, %hsh ); $thread->join(); sub subrt { my %args = @_; print APP::Plugin->execute(%hsh); } #Code for Plugin module package APP::Plugin; use strict; use warnings; sub execute { my $class = shift(); my %abc = @_; foreach (keys %abc) { print $_. "---" . $abc{$_}."\n"; } } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Not geting Shared variable of parent process into the thread
by avanta (Beadle) on Jun 25, 2010 at 07:11 UTC | |
|
Re^2: Not geting Shared variable of parent process into the thread
by avanta (Beadle) on Jun 25, 2010 at 07:11 UTC | |
by avanta (Beadle) on Jun 25, 2010 at 09:56 UTC | |
by bluescreen (Friar) on Jun 25, 2010 at 13:11 UTC |