Rose::DB::Object into thread::shared object - how?

42 views
Skip to first unread message

bvn13

unread,
Feb 9, 2012, 11:53:53 PM2/9/12
to rose-db...@googlegroups.com
package Test;

sub new
{
   my $self = shared_clone({
      'data' => shared_clone([])
   });
   return bless $self;
}

sub my_thread
{
   my $self = shift;

   #here I want to add a link to some Rose::DB::Object into shared array $self->{'data'}
}


how can I add an Object into shared array?

bvn13

unread,
Feb 9, 2012, 11:58:52 PM2/9/12
to rose-db...@googlegroups.com
and how can I add an object like this

my $obj = Persons->new(
   'name' => 'asd',
   'child' => Kids->new('name' => 'zxc')  #here is an error
)

into shared array?

John Siracusa

unread,
Feb 10, 2012, 6:14:45 PM2/10/12
to rose-db...@googlegroups.com

Does this question have anything to do with Rose::DB::Object? It
seems like a question about Perl threading.

-John

John Siracusa

unread,
Feb 10, 2012, 6:15:25 PM2/10/12
to rose-db...@googlegroups.com

Wasn't there another thread on this topic already?

http://groups.google.com/group/rose-db-object/browse_thread/thread/df5ef26282dec713

-John

bvn13

unread,
Feb 11, 2012, 2:27:38 AM2/11/12
to rose-db...@googlegroups.com
yes, basically, it is a question about perl threads, but with reference to perl-objects and Rose::DB::Object  in particular.
I didn't find any internet community more responsable than this. So, sorry for offtopic, but I really don't understand how can I solve this problem... :(

bvn13

unread,
Feb 11, 2012, 2:30:33 AM2/11/12
to rose-db...@googlegroups.com
it is that project, that previous question was about. but now I want to use threads in it.

bvn13

unread,
Feb 11, 2012, 3:37:13 AM2/11/12
to rose-db...@googlegroups.com
Here is a text of the error:

Thread 2 terminated abnormally: Unsupported ref type: CODE 

bvn13

unread,
Feb 11, 2012, 7:07:59 AM2/11/12
to rose-db...@googlegroups.com
This question is about how to share Rose::DB::Objects with its relationships. 
Sorry, but I hope somebody from here has solved such problem and can help me.
But  I have to close my question in course of my question is so offopically

John Siracusa

unread,
Feb 11, 2012, 9:59:31 AM2/11/12
to rose-db...@googlegroups.com
On Saturday, February 11, 2012, bvn13 <mail...@gmail.com> wrote:
> Here is a text of the error:
>
> Thread 2 terminated abnormally: Unsupported ref type: CODE 

Serializing a Rose::DB::Object can remove code references.  The Rose::DB::Object::Helpers module has some serialization helper methods.  Examples:

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Helpers.pm#as_tree_%5BPARAMS%5D

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Helpers.pm#new_from_tree_TREE

-John

Perrin Harkins

unread,
Feb 11, 2012, 5:40:31 PM2/11/12
to rose-db...@googlegroups.com
On Sat, Feb 11, 2012 at 2:30 AM, bvn13 <mail...@gmail.com> wrote:
> it is that project, that previous question was about. but now I want to use
> threads in it.

If you're working on Linux or a similar OS you're probably better off
using processes. Copy-on-write means that forking usually uses less
memory than Perl threads, which copy almost everything when they spawn
a new one.

- Perrin

Reply all
Reply to author
Forward
0 new messages