in reply to Dynamically wrapping ancestor method calls
It was me who asked that question on #perl.
I could not think of a clean solution to solve that problem using subclassing. Therefor I now use a pattern like this:
sub new { my $class = shift; my $obj = SomeClass->new( @args ); bless \$obj, $class; } sub AUTOLOAD { ...; $$self->$meth( @_ ); ...; }
This creates a wrapper class around the class I initially tried to subclass and delegates all method calles to the inside object using AUTOLOAD. This works pretty well so far.
Cheers, Flo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dynamically wrapping ancestor method calls
by polettix (Vicar) on Dec 11, 2006 at 15:19 UTC | |
by chromatic (Archbishop) on Dec 11, 2006 at 19:36 UTC | |
|
Re^2: Dynamically wrapping ancestor method calls
by Limbic~Region (Chancellor) on Dec 11, 2006 at 14:56 UTC |