in reply to Re^2: 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.

myModule has following code in its new sub routine, does it has any flaws:

I don't see any flaws with that "class method"

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.

?? File::FindLib - Find and use a file/dir from a directory above your script file
?? FindBin - Locate directory of original perl script

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.

Um, try

sub new { my( $class, %args ) = @_; my $self = bless { %args }, $class my $query = CGI->new; my $sessionargs = $self->{sessionargs} || $default_sessionargs; my $session = CGI::Session->load( $sessionargs->{dsn}, $query, $sessionargs->{dsn_args}, ) or die CGI::Session->errstr; $self->{query} = $query; $self->{session} = $session; return $self; } sub param { my $self = shift; $self->{query}->param( @_ ); } sub session { $_[0]->{session}; } sub fandango { my( $self ) = @_; $self->param ...; ...; $self->session->param ...; ...; }

Things like that, see http://cgi-app.org//CGI::Application
http://mojolicio.us/perldoc/Mojolicious/Guides/Growing
Re^3: web applications: what is the correct way to realise web applications
Re: I need wisdom on structuring procedural code in Catalyst
Re: Form validation and best practice in CGI::Application
Re^2: mod_perl website structure
Re^2: High level OOP query ( Building Skills Object-Oriented Design Mindset Development )
Re^3: High level OOP query (internal data),
Re: RFC: beginner level script improvement (version control)
Re: Perl MIME parser partially works with my code I wrote (code does not exist , there is no code)

  • Comment on Re^3: Blank HTTP POST request, if script has another module in it. (CGI.pm)
  • Download Code

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

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