Good points from both of you. Thank you very much.
I've gone with this:
sub action { if ( DEBUG ) { my $loggerClass= $self->_getLoggerClass(); my $loggerHandle= eval($loggerClass ."::getLoggerHandle()"); } } sub _getLoggerClass { my ( $self )= @_; my @_isa_parts = split '::' => ref($self ); return $_isa_parts[0] . '::Debug::Logger'; }
MyApp::Debug::Logger::getLoggerHandle() is a factory method that tosses me a new Logger object from a pool
I kind of like how this works now, and could conceivably consolidat a bit of code with this. So i'm wondering if anyone has a suggestion on how I could call a package function with this, and pass in variables.
i.e., do something like:
I don't know if that shows a clear intent or notmy $loggerClass= $self->get_loggerClass(); eval('&'.$loggerClass .'::writeToLoggerHandle($self,$text)');
In reply to Re: Getting parent class data
by nmerriweather
in thread Getting parent class data
by nmerriweather
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |