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-02-12 12:38:57.26109-08 by tetley in response to 12374
Re: Shared variables across require?
I really appreciate the very fast response, but same problem. Now, thread it:

use strict; use warnings; use threads; use threads::shared; our %tid : shared; sub start_th { $tid{hello} = 99999; $tid{hello} = 88888; print("1: " . $tid{hello} . "\n"); require "child.pl"; print("2: " . $tid{hello} . "\n"); $tid{hello} = 22222; } my $myth = threads->create(\&start_th); $myth->join(); print("3: " . $tid{hello} . "\n");


child.pl is a straight cut-and-paste of what you had. In fact...the 22222 didn't even register, and that's after the require--not in it. Comment out the require, and it does. I get 88888 with require, 22222 without.
Direct Responses: 12377 | Write a response