|Don't ask to ask, just ask|
Thanks for responding. Firstly note that I broke the code down, excluding un-related parts. I am actually sending the headers only once. Once I have printed the redirect header, I exit the script (exit(1)). Its doing everything fine, its just not registering that i'm logged in, if I visit the page in a particular way (i.e. from the homepage after logging in, or from a redirect index page).
If its doing everything fine, then why is there a problem?
redirect does not print a session cookie
No session cookie, means no session.
Your code fragment is too dense, but I was able to spot the problem (redirect without cookies)
If you follow the guidelines of How do I post a question effectively?, and post a small/short, self-contained program, which demonstrates the bug/problem, undesirable output/behaviour, we can better help you, and you can believe us when we do :)
I have used CGI:Session on many occassions, but never for such a task. I have read the tutorial, as well as the main documentation a few times. From what I gathered, you don't need to pass an SID, unless the user has i.e. cookies disabled. The module should handle everything automatically.
How do you think the module handles everything automatically?
The sid has to get passed somehow.
If you use header method, it goes by way of cookie. CGI::redirect() doesn't know about CGI::Session, so no cookie.