in reply to Blank HTTP POST request, if script has another module in it.

Its simple, myModule has code in it which does more than define general HTML content generating sub routines in it it reads all the POST data and makes it unavailable to your main program

One way this could happen is using  my $q = CGI->new; instead of  my $q = CGI->new( { } );

First version will consume POST data the second one won't

Replies are listed 'Best First'.
Re^2: Blank HTTP POST request, if script has another module in it. (CGI.pm)
by msinfo (Sexton) on Feb 17, 2014 at 07:46 UTC
    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.
        Hi, Anonymous Monk

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

Re^2: Blank HTTP POST request, if script has another module in it. (CGI.pm)
by msinfo (Sexton) on Feb 17, 2014 at 07:18 UTC
    Oops! I replied, to your first post, without reading, this one.

    Testing, what you have said, and would communicate back results. Thanks for giving pointer.