Please don't touch CGI->state directly in client code - use callbacks instead. I'd like to make some mechanics-critical handlers in CGI const - a lot of work, certain changes have been done here.