Shades has asked for the wisdom of the Perl Monks concerning the following question:
The $mcvpservers is a hash_ref with a queue at the 2 index. I have created the queue as a shared: our @queue : shared = (); Everytime I enter the queuecommand, my queue is empty. What have I done wrong?sub queuecommand { my ($mcvpservers, $cmd, $priority, $server, $file, $time) = @_; my @tmp : shared; @tmp = ($cmd, $priority, $server, $file, $time); my @queue = $mcvpservers->{$server}->[2]; print $#queue+1; if ($#{$queue[0]}+1 == 0) { push @queue, \[@tmp]; } else { for(my $i = 0; $i < $#queue+1; $i++) { if ($priority > $queue[$i][1]) { splice @queue, $i, 0, \[@tmp]; last; } } } print $#queue+1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Shared variable not changing?
by weismat (Friar) on Mar 17, 2009 at 10:40 UTC | |
|
Re: Shared variable not changing?
by BrowserUk (Patriarch) on Mar 17, 2009 at 11:15 UTC | |
|
Re: Shared variable not changing?
by zentara (Cardinal) on Mar 17, 2009 at 13:12 UTC | |
|
Re: Shared variable not changing?
by Anonymous Monk on Mar 17, 2009 at 10:20 UTC | |
by Shades (Initiate) on Mar 17, 2009 at 10:26 UTC | |
by almut (Canon) on Mar 17, 2009 at 10:38 UTC | |
by Shades (Initiate) on Mar 17, 2009 at 11:03 UTC | |
by almut (Canon) on Mar 17, 2009 at 11:16 UTC | |
|
Re: Shared variable not changing?
by Shades (Initiate) on Mar 17, 2009 at 14:50 UTC |