Data sharing
Yeah, I've had a look at the documentation. I also saw blessed hashes may be blessed in one thread but not in another. So I have to have a closer look at that.

Main threat that communicates with the objects
Your idea of the main threat maintaining the objects might be a good idea and I will consider it the most likely to use possibility for the moment.

One thread per NPC?
No, I was not intending to give every NPC its own thread. Actually, I only need two threads: one to take care of all NPC's (all NPC's are allowed to do their things one by one, maybe in a random order, maybe in order-of-appearance in the "realm"), one to take care of the human (well... let's hope so :D ) player.

thinking aloud mode
While philosophing a little about that, it might be a good idea to create a new thread whenever a new NPC has to be spawned. Then, within that thread, the first thing to do is to create a new instance of the appropriate class. But philosophing a little more, I come to the conclusion this will give problems when different objects need to get each other's data. This maybe might be solved by having subroutines in the main module that can access objects data. Although I do not quite see how to do this, it is worth to keep in mind, somewhere.

For now... thank you!
Good, it's late over here already and I am getting too tired to think straight, so I'll continue tomorrow. I've been playing around a little with programming different threads and I master the basics of it, so that part will not be too difficult.

So far, thank you all for all the hints, help and links to documentation you gave me!

In reply to Re: Re: Re: Re: Re: Re: Data copied with fork() -> how to access true data? by muba
in thread Data copied with fork() -> how to access true data? by muba

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.