Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

(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).


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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://86672]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2018-06-20 08:08 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (116 votes). Check out past polls.