I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2010-05-14 13:00:40.687545-07 by jdhedden in response to 12704
Re: Passing shared variables among subroutines for thread::shared variables
Main code:
#!/usr/bin/perl use strict; use warnings; use threads; use threads::shared; use bork; our $bork : shared; MAIN: { print("Setting to 123\n"); $bork = 123; threads->create('bork::thr')->join(); } print("Done\n"); # EOF
Code for 'bork.pm':
#!/usr/bin/perl use strict; use warnings; package bork; use threads; use threads::shared; sub thr { print("I see it as '$::bork'\n"); } 1; # EOF
The key is that variables in the 'main' package are accessed as $::var, etc..
Direct Responses: Write a response