PetaMem has asked for the wisdom of the Perl Monks concerning the following question:
What do we need? We need a simple iterator:
a simple call to this iterator:sub iterate { my $code = shift; my $back = TRUE; for(@_) { if(&$code($_) == FALSE) { $back = FALSE; } } return $back; }
Yeah! This works. Great. No surprises here.&iterate(\&attach,@param);
And now some unfortunate OO efforts - such as making attach the method of an object.
And thenmy $rep = Module->new();
we try pitifully to reference this method:
Ok. So questions. Howto? Bad design? (Well the iteration is fairly generic and doesn't hurt any encapsulation). The camel book desn`t help here much, it just states "be nice". Damians OO book didn't mention it (at least I didn't find it).&iterate($rep->attach(),@param); # ?? No &iterate(\$rep->attach(),@param); # ?? Noooo &iterate(\{$rep->attach()},@param); # ?? Hehe...
Bye
PetaMem
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Referencing methods
by dragonchild (Archbishop) on May 08, 2003 at 15:43 UTC | |
|
Re: Referencing methods
by artist (Parson) on May 08, 2003 at 15:48 UTC | |
|
Re: Referencing methods
by hardburn (Abbot) on May 08, 2003 at 15:45 UTC | |
|
Re: Referencing methods
by Thelonius (Priest) on May 08, 2003 at 15:48 UTC | |
by chip (Curate) on May 08, 2003 at 16:03 UTC | |
|
Re: Referencing methods
by broquaint (Abbot) on May 08, 2003 at 15:48 UTC | |
by Elian (Parson) on May 08, 2003 at 15:55 UTC | |
by broquaint (Abbot) on May 08, 2003 at 16:05 UTC | |
by Elian (Parson) on May 08, 2003 at 17:15 UTC |