use threads ();
my $foo;
threads->new( sub {print "thread: coderef = ".\$foo."\n"} )->join;
print " main: coderef = ".\$foo."\n";
####
use threads ();
sub foo {1}
threads->new( sub {print "thread: coderef = ".\&foo."\n"} )->join;
print " main: coderef = ".\&foo."\n";
##
##
use threads ();
threads->new( sub {
use Benchmark; # just an example module
# do your Benchmark stuff
} )->join;
print "Benchmark has been loaded!\n" if defined $Benchmark::VERSION;
##
##
use threads ();
threads->new( sub {
require Benchmark; Benchmark->import;
# do your Benchmark stuff
} )->join;
print "Benchmark has not been loaded!\n" unless defined $Benchmark::VERSION;
##
##
use threads ();
threads->new( sub {
print "Benchmark has been loaded!\n" if defined $Benchmark::VERSION;
# do your Benchmark stuff
} )->join;
use Benchmark;
##
##
use threads ();
my $thread;
BEGIN { # execute this at compile time
$thread = threads->new( sub {
print "Benchmark has not been loaded!\n" unless defined $Benchmark::VERSION;
# do your Benchmark stuff
} );
}
use Benchmark;
$thread->join;