in reply to Data copied with fork() -> how to access true data?

Well, if you want to use threads, you can get a more recent perl with better thread support, or take a look at forks - it emulates the newer thread API using fork().

OTOH, you might use something like POE to get callbacks into 1 process/thread whenever an event is triggered. You could maybe even get away with using alarm() to trigger your own timeouts if you want to get that low-level.

If you are using Tk or some other GUI toolkit, most of them also have some kind of event handling to accomodate this kind of thing (see Tk::Eventloop for instance)

One other strategy that might help if you run multiple processes already (say, for instance you're running the game from CGI or mod_perl) is to use a shared data storage (like a relational database), so all data can be shared "automatically" as long as you check for updates periodically. Other options here are IPC::ShareLite and Cache::Cache.

Have fun figuring out which one you like :-)

Joost.

  • Comment on Re: Data copied with fork() -> how to access true data?

Replies are listed 'Best First'.
Re: Re: Data copied with fork() -> how to access true data?
by muba (Priest) on May 31, 2004 at 21:55 UTC
    It's text based, not internet connected, so no Tk, no CGI, no mod_perl. But I'll check out the other things!

    Thanks a lot!

    Besides... I know almost nothing about databases so that would be one of the last things I'll do, but thanks for the hint anyway.
        This looks most interesting! Although the select documentation only mentions how to block (not how to unblock) a FH. It would be logical if unblocking is just the opposite, but I don't quite understand the $rin, $rout, $win, $wout bit things. Could you maybe give some more clues?

      "...not internet connected..."

      Wouldn't that make it a SUD? :)

      cLive ;-)

        Actually, it would.

        "single player MUD like".

        Single Player. MUD like. But yes, you're right :)