From: david nicol [EMAIL PROTECTED]
> foreach (grep { $_->{smoker} and $_->{age} > 18 } @Subscribers){ 
>                 $->send($Cigarette_Advertisement) 
>       } 
> 
> This would imply an extension of the array tieing 
> interface, so we can send the grep block to the
> data server, and get back a generator object for
> foreach to shift qualifying subscribers off of.

I'm uncomfortable with the idea of an object reaching out and overriding
other functions.  What if I really want to grep through everything in the
array? How would this work if the grep block is passed to another server:

  grep {
      print STDERR 'testing:', $_{name}, "\n";
      $_{smoker} and $_{age} > 18;
      }

That's not to say that grep and map methods might not be a nifty idea as
tied array methods, but let's keep it to an object-perpsective, say
something like this:

  @Subscribers->grep({ $_->{smoker} and $_->{age} > 18 });

I'll grant you that tied hashes already "reach out" and override commands
like each and keys, but those are very simple commands that only take a
hash as an argument, not other complicated arguments like blocks.

Personally, I can't help but think that in any situation in you need to use
a tied array for that sort of complexity you'd probably do better with a
real SOAP object that has methods like return_qualified_smokers.

-Miko

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .


Reply via email to