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)
In reply to Re^3: Blank HTTP POST request, if script has another module in it. (CGI.pm)
by Anonymous Monk
in thread Blank HTTP POST request, if script has another module in it.
by msinfo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |