|
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.. |