Thanks!
Right now, I should have been more clear, though -- I'm am kinda doing a bit of each approach you mentioned -- but i am in need of a little more help.
I think what i want is more of your second approach right now...
Let me elaborate for a moment....
WebAppFramework::DB.pm
Base Class
Users Apache:DBI
Package handles all DB abstraction and connectionsWebsite1::DB.pm
SubClass of WebAppFramework::DBI.pm
Package has configuration information (host/port/user/pass/etc)Website2::DB.pm
SubClass of WebAppFramework::DBI.pm
Package has configuration information (host/port/user/pass/etc)
Website1/Website2 are different package directories that subclass the framework
I'm showing Website1/Website2 just to illustrate the namespace
In the example on my last post, my handle does this:
package Website1;
my $DB = new Website1::DB();
# make a new ref for the website
sub handler
{
my $r = shift;
my $user = new Website::User( \$r, \$DB );
my $page = new Website::Page( \$user , \$DB );
my $html = $page->processRequest();
}what i would like is:
sub handler
{
my $r = shift;
my $user = new Website::User( \$r );
my $page = new Website::Page( \$user );
my $html = $page->processRequest();
}now, i guess what i'm trying to do within
Website1::User
Website1::Page
is access the
$DB in the base of Website1 that i define just before the handler
BUT
I'm trying to do so in a way that both:
Website1::PackageName
Website2::PackageName
WebAppFramework::PackageName
Will all retreive the correct DB from the script that defines the handler
I've tried this a few different ways, but I've often ended up reading WebAppFramework::$DB instead of Website1::$DB
I guess I'm trying to figure out a way for the baseclasses to access information in the subclasses - which sounds wrong, stupid and impossible.
Does that make more sense? Does your suggestion still apply?
Sorry, I'm just very confused by all this myself, and I fear that i'm not asking the right questions.
On Nov 17, 2004, at 12:11 PM, Michael Schout wrote:
There are many ways to solve this problem. I'll show you 2 ways. I'll focus just on the database part to keep this as short as possible, but the same ideas apply to the user object...
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html
