in reply to how to create a "delegating" array?
I guess you'll need to return another object (untested):
package MapDelay; sub new { my ($class,@self) = @_; bless \@self, $class; }; sub AUTOLOAD { (my $m = $AUTOLOAD) =~ s/.*:://; my $self = shift; map { $_->$m(@_) } @$self }; package Foo; sub foo { return MapDelay->new( Bar->new, Bar->new, Bar->new ); };
Also, Bar->new x3 stores three copies of the same object. I'm not sure if you wanted that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to create a "delegating" array?
by holli (Abbot) on Nov 29, 2009 at 09:21 UTC | |
by happy.barney (Friar) on Nov 29, 2009 at 09:44 UTC |