APM: Clarified OOP problem
wwalker at bybent.com
Sun Sep 14 12:08:48 CDT 2003
But I sure feel stupid
On Sun, Sep 14, 2003 at 12:57:23PM -0400, Mike Stok wrote:
> On Sun, 14 Sep 2003, Wayne Walker wrote:
> > I have an issue about dynamically calling Class methods (rather than
> > object methods) from a derived Class. Any help would be appreciated.
> I'm not quite sure where the convert ought to live, but does this help
< Mike set the calling sytax to $class->get_dust() >
Yes, I swear that I started with $class->get_dust(); and it didn't work.
I must have had something else wrong and thought it was an issue with
how I was dynamically calling a subroutine from another package.
Here's the test program (Mike's version but trimmed to the essentials in
showing the solution to my stupid problem.
my $miracle = Foo::Bar->get_data();
print $miracle, "\n";
my $class = shift; # this will = Foo::Bar at runtime
my $magic_dust = $class->get_dust();
print $magic_dust, "\n";
return $magic_dust . "via Foo::get_data()";
use base 'Foo';
return "Got dust from Foo::Bar";
www.broadq.com :) Bringing digital video and audio to the living room
More information about the Austin