With mod_perl, i get a one digit number that changes randomly (random = "jameshasnoclue"). I read about this in the mod_perl documentation.

If you read about it then you understand that Apache forks servers to handle requests and that each process has its own embedded perl interpreter and each intepreter has its own copy of the variable. So, if you want them to all share and/or modify the same value, then you need to store the value outside of the process and make sure that all of the processes update it in an orderly manner.

A common way to do that is to put the value in a file and then have your script use voluntary locking for access to it. If this is primarily a learning experience, it would probably be worthwhile for you to implement that. If you just want to get it working, there is likely to be a module available on CPAN that would help, though I don't know which.

-sauoq
"My two cents aren't worth a dime.";

In reply to Re: Persistent memory with mod_perl and a module. by sauoq
in thread Persistent memory with mod_perl and a module. by true

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.