APM: Clarified OOP problem
wwalker at broadq.com
Sun Sep 14 11:34:18 CDT 2003
I have an issue about dynamically calling Class methods (rather than
object methods) from a derived Class. Any help would be appreciated.
The most important note here is that these are Class methods, NOT object
methods. Therefore, there is no object.
There is no object, no $self, the methods are being called by
Because of the ISA relationship, calling Foo::<any subclass>::get_data
will call Foo::get_data, since get_data is not defined in any of the
That part is working as advertised. $class IS being properly set to the
Name of the class (not a blessed referent, just the text string name of
the class). Therefore, I thought that perl would handle:
# $class = 'Foo::Bar'
What syntax would replace $class::get and do what I want it to.
$miracle = Foo::Bar::get_data();
my $class = shift; # this will = Foo::Bar at runtime
$magic_dust = $class::get_dust();
$miracle = convert($magic_dust);
use base 'Foo';
The problem is that I cannot get the syntax right to run
Foo::Bar::get_dust() inside Foo::get_data().
There will also be Foo::Baz::get_dust().
Applications will call the non-existant Foo::Baz::get_data
www.broadq.com :) Bringing digital video and audio to the living room
More information about the Austin