That data won't be shared after forking is to be expected; forking creates a whole new process that is completely seperate from the old one (on UNIX-like platforms, this is simulated on Windows, see perldoc perlfork.)

If you want to share data between the processes, you can look to the IPC::Shareable or IPC::ShareLite modules though I don't know think they'd work on windows. You could also try a "real" database, or some DBM file that you would lock for every read and write.

Note that $::PRESISTENT_HASH is not the hash created with my %PRESISTENT_HASH. The my statement creates a lexically scoped (to the file the my is in, in this case) variable, not a global variable, which is what %::PRESISTENT_HASH is.


In reply to Re: Persistant data using Net::Daemon in fork mode by wog
in thread Persistant data using Net::Daemon in fork mode by Anonymous Monk

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.