Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

(Knob)Re: Re: How to code the session page

by knobunc (Pilgrim)
on Jun 07, 2001 at 22:27 UTC ( #86672=note: print w/ replies, xml ) Need Help??


in reply to Re: How to code the session page
in thread How to code the session page

I upveoted you because I agree that a good way to learn is to tinker with stuff. However, you certainly shouldn't clutter CPAN with duplicate modules. Perhaps the best thing to do is start with the appropriate CPAN module and make it do what you want then release the changes back to the author so that they can be incorporated into the next version. Hopefully that way you learn the guts & theory, think of some stuff that you never realized about the problem before and everyone benefits since another set of eyeballs have looked at the code and another brain has thought about it. The end result should be a more powerful, more general, more reliable piece of software.

BTW session management is tricky. The Apache::Session modules is very cool because it has different pluggable lock and storage modules. Getting storage correct is non-trivial since you need to decide what semantics your sessions should have. Things to think about are how you want your session to behave when two requests happen simutaneously. Will the change that happens second blow away the first even if the first has not yet written the state? Will the second page block until the first change happens? If you decide that you do not need blocking did you remember at least to lock the session object when it is being read and written so that changes mid-read or write do not corrupt the session.

You can choose not to think about this and your code will work most of the time, but when the load gets high and pages start holding the sessions open for a while you will start getting weird errors that are very hard to track down. The Apache::Session code has a Transaction argument you can pass to lock the session from when it is read from disk until it is closed. It also locks the object when it is being changed (even if you are not in transactional mode).

-ben


Comment on (Knob)Re: Re: How to code the session page

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://86672]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2014-09-16 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (7 votes), past polls