threads::shared::share behaves differently when imported or not

[email protected] (Stas Bekman)
Newsgroups perl.ithreads
Organization Hope, Humanized
Message-ID <[email protected]>
if I 'use threads::shared', share() works as documented:

perl-5.8.1-ithread -le 'use threads; use threads::shared; my $x; share($x); $x 
= 1;'

perl-5.8.1-ithread -le 'use threads; use threads::shared; my $x; 
threads::shared::share($x); $x = 1;'

However if I 'require threads::shared', it doesn't work the same way:

perl-5.8.1-ithread -le 'use threads; require threads::shared; my $x; 
threads::shared::share($x); $x = 1;'
Argument to share needs to be passed as ref at -e line 1.

If I pass \$x it works.

If I explicitly import share it doesn't.

perl-5.8.1-ithread -le 'use threads; require threads::shared; 
threads::shared->import(qw(share)); my $x; share($x); $x = 1;'
Argument to share needs to be passed as ref at -e line 1.

why?

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[email protected] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.