in reply to Confused by use base, I think.
Ikegami: Your warn(ref($self)) gives me:
and uncommenting the debug code you mention yields:test-cgi-tabpane.cgi: My::New::Module::Admin
Chromatic: I renamed my My::New::Module::Admin::new() method, as My::New::Module::Admin::_new, hoping that would force it to inherit My::New::Module::new instead. So I assume you want to see that, which reads:main /usr/lib/cgi-bin/test-cgi-tabpane.cgi 51
I'm not sure what additional clues that provides us, but am grateful others are looking at this with me. Thanks again.sub new { my $class = shift; my $defaults = shift; my $self = {}; if(defined($defaults->{'object'}) && (UNIVERSAL::isa($defaults->{'object'},'My::New::Module') || UNIVERSAL::isa($defaults->{'object'},'My::New::Module::WWW'))){ $self = $defaults->{'object'}; } elsif(defined($defaults->{'cfg'}) && UNIVERSAL::isa($defaults->{'cfg'},'Config::Simple')){ $self->{'cfg'} = $defaults->{'cfg'}; } elsif(defined($defaults->{'config_file'})){ my $config_file = $defaults->{'config_file'}; # print STDERR $config_file,"\n"; $self->{'cfg'} = Config::Simple::Inherit->inherit({ filename => $c +onfig_file }); } elsif(defined($defaults->{'config_files'})){ my $cfg; undef($cfg); foreach my $file (@{$defaults->{'config_files'}}){ # print STDERR "My::New::Module::WWW->new() # says \$file is $file \n"; $cfg = Config::Simple::Inherit->inherit({ base_config => $cfg, filename => $file }); } $self->{'cfg'} = $cfg; # print STDERR Dumper(\$cfg); } else { die "Constructor invoked with no Confirguration File." } $self->{'q'} = CGI->new(); $self->{'agent'} = WWW::Mechanize->new(); my $db1 = $self->{'cfg'}->get_block('db1_params'); my $db2 = $self->{'cfg'}->get_block('db2_params'); # print STDERR Dumper(\$db2),"\n",Dumper(\$db2); $self->{'dbh1'} = My::New::Module::DB->connect2($db1_params); $self->{'dbh2'} = My::New::Module::DB->connect2($db2_params); $self->{'s'} = CGI::Session->new( undef, $self->{'q'}, { Directory => '/tmp/sessions'} ) or die CGI::Session->errstr; $self->{'s'}->expire('+1h'); $self->{'s'}->flush(); my $auth_params = $self->{'cfg'}->get_block('auth'); $self->{'auth'} = CGI::Session::Auth::DBI->new({ CGI => $self->{'q'}, Session => $self->{'s'}, DBHandle => $self->{'dbh1'}, EncryptPW => $auth_params->{'EncryptPW'}, GroupField => $auth_params->{'GroupField'} }); bless $self, $class; return $self; }
-- Hugh
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Confused by use base, I think.
by chromatic (Archbishop) on Jun 15, 2008 at 13:21 UTC |