Forum Moderators: coopster & phranque

Message Too Old, No Replies

CGI or CGI::Simple

Multiple instances...

         

Dabrowski

5:31 pm on Mar 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok, I'm trying to write myself little modules to sit on top of CGI, and DBI to automate a lot of my repetetive code.

One of these is a little session thing to time sessions out and store paramters in a DB.

When the module loads it does a 'new CGI::Simple' and checks for a session cookie to do it's stuff.

The problem I have is that in my main program I have another 'new CGI::Simple' for processing my form data.

What's happening is, the CGI Simple in the session module is stealing the POST data, so in my main program I can't get my form data. If I use GET then it's fine, and the content type and length are preserved.

Has anyone used CGI like this before?

phranque

12:10 am on Mar 5, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you need to have your main program handle the post data and serve it to your session program as requested.
you can have your main program return a CGI or CGI::Simple object to your session module so that you can still use the methods you need...

Dabrowski

1:18 am on Mar 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Shame, I was hoping to make it tidier than that.

Can't I have it automatically output the data back to STDIN somehow?

chorny

6:20 pm on May 10, 2008 (gmt 0)

10+ Year Member



You need to have only one CGI::Simple object. Just use it from one central module. I do the same with DBI object.

Or caller may transfer CGI::Simple object to subroutine.