[cgiapp] New to working with CGI::App and OO perl. Testing under mod_perl. The old inconsistent data with reloads problem.

Derek Walker jagabaya at gmail.com
Thu Mar 19 11:35:01 EDT 2009


I'm writing a very basic app under apache + mod_perl.

I've made the super vanilla instance script and application module.

=====
#!/usr/bin/perl
use lib '/var/www/html/infra';
use Physical;

my $app = Physical->new();
$app->run();
=====
package Physical;
use strict;
use warnings;
use base 'CGI::Application';
use DBI;
use CGI::Carp qw( fatalsToBrowser );
#####
my $dbh;
my $user;
my @roles;
my $c_id;
#####

#    for $i ( 0 .. $#ref ) {
#        for $j ( 0 .. $#{$ref[$i]} ) {
#            $ref[$i][$j];
#        }
#    }

sub setup {
=====

<SNIP>

I'm running into the old chestnut of a problem of how to properly
'wrap' a perl application under mod_perl to avoid the shared global
variable issue (that I only partially understand at this point)

Reading from a couple of books and web sites I can see the basics of
how to wrap things to avoid this collision, but I can't quite make it
work for my basic test app.

Is there a quick or easy way to modify the instance script to make it
play better under mod_perl?

Thanks.

-- 
-Derek

"Nothing will work unless you do."

PGP: CA0C 4699 5B89 930F FD1D  705A 6CBF 52F9 4612 6276


More information about the cgiapp mailing list