Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
You can use "global" in memory values, but only as constants. Once you change the value in one place, it only changes there. There's a couple of ways you can make read-write globals. Via a database (as mentioned above), via a second instance of Apache::Session (or CGI::Session) using a constant superLongSecretKeyThatDoesn'tFitTheAutoGenerateFormatKey (ahem) or something like IPC::ShareLite to get true "shared across all children" global variables.

The Database method might have some performance penalties, but the advantage is that if you every start load balancing web servers, your global variables are still global.

The Secret Session method, is probably the fastest and easiest to code, since you already have similar parts in your program, but it also has some security implications surrounding your secret session key.

The IPC::SharedLite method requires installing a new module and learning some new (but realively straight forward) techniques. The amount of "shared" memory on a system is much smaller than "main" memory (at least with Unix) so you can't cram it TOO full, but it will yield the desired effect. For what you're trying to do, I'd be tempted to pick this method.

/\/\averick


In reply to Re^4: mod_perl and multiuser global variables by maverick
in thread mod_perl and multiuser global variables by rsennat

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-03-28 22:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found