From: Aaron P. <aar...@sp...> - 2004-01-30 18:02:48
|
Maurice Aubrey wrote: > Aaron Patterson wrote: > >> Maurice, >> Sorry to bug you like this, but the list is still broken... I've >> been >> subclassing Text::Forge::ModPerl so that I can add session info and >> other stuff >> to my text forge pages. I think I've found an inheritence problem in >> Text::Forge::ModPerl, but it may be that I'm doing my subclassing >> incorrectly. >> I think there is a problem in the handle method of Text::Forge::ModPerl. >> >> I think the line that says: >> >> my $cfg = MP2 ? Apache::Module->get_config(__PACKAGE__, $r->server, >> $r->per_dir_config) : Apache::ModuleConfig->get($r); >> >> should read: >> >> my $cfg = MP2 ? Apache::Module->get_config($class, $r->server, >> $r->per_dir_config) : Apache::ModuleConfig->get($r); > > > Thanks, applied. > Is this because you want to add custom directives from your subclass? This is because I found that __PACKAGE__ was getting set to 'Text::Forge::ModPerl' instead of my subclass, and it was getting the wrong config values. The ForgeINC array kept showing up blank, even though I was setting it in my apache config! > > Two questions about your subclass. I'm not clear on why you need to > override the handler() method. And when I override send(), I > do this at the end: > > $self->SUPER::send(@_, $cgi, $session); > > Rather than trapping it and outputting it from the subclass. I needed to overrid the handler method, because $class in handler would be set to 'Text::Forge::ModPerl', instead of my subclass. So when new was called on $class, my subclass would not get instantiated. Since my class wasn't instantiated, my send method didn't get called. Doesn't that happen with your subclass? Maybe this is a mod_perl 2 issue? As for the send method, I /should/ be calling SUPER::send. I need to fix that! > > Maurice > --Aaron |