in reply to trouble writing threaded and object oriented

I don't think you can;
as threads::shared states:
bless is not supported on shared references. In the current version, bless will only bless the thread local reference and the blessing will not propagate to the other threads. This is expected to be implemented in a future version of Perl.
update
Hmm... there seems to be Pots::SharedObject, but as i look at the version number it's in early stages.

"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
  • Comment on Re: trouble writing threaded and object oriented

Replies are listed 'Best First'.
Re^2: trouble writing threaded and object oriented
by roben (Initiate) on Jul 20, 2005 at 10:56 UTC
    Thanks! I searched CPAN and im sure it was not there 2 hours ago ;-) Ill check it out, results will be posted here!

    Result:

    Pots::SharedObject did'nt help much here, because it shares all instances of a class and the thing i really don't like is that you have to modify the class and it's constructor to make it work.
    I guess i'll better wait until Perl is ready for "my $obj : shared = new My::Class;" because that's the way it has to be.