in reply to Re: Blank HTTP POST request, if script has another module in it. (CGI.pm)
in thread Blank HTTP POST request, if script has another module in it.

Hi Anonymous Monk,

You said

my $q = CGI->new; instead of my $q = CGI->new( { } );
and
. . . reads all the POST data and makes it unavailable to your main pr +ogram

Yes both, cases were true. I changed them and now everything is working fine. Just to confirm whether I am following good coding practice or not, below are my few doubts on same line.

  1. myModule has following code in its new sub routine, does it has any flaws:
    sub new { bless {}, shift }
  2. How do I use relative name scheme? (instead, of using : use lib 'D:\\Websiste\\One\cgi-bin';) I tried earlier, but it failed. Normal CGI scripts and myModule are in same directory.
  3. In myModule, I was using my $session = CGI::Session->load or die CGI::Session->errstr; at global scope to check sessions, before generating HTML contents. Now after your suggestion, I moved same code in each sub routine. But this duplicates code, and I have to write it in, every sub routine. Is there any work around for same. Or all session handling code should be put into different sub routine.

Replies are listed 'Best First'.
Re^3: Blank HTTP POST request, if script has another module in it. (CGI.pm)
by Anonymous Monk on Feb 17, 2014 at 08:42 UTC
      Hi, Anonymous Monk

      This post, not only answers, my original questions, but would also clear my upcoming doubts, on same path. Thanks!