Hmm, now that I come back to look at it with fresh mind, it occurs to me that I led me reduce abstraction ad absurdum the moment I used eval (which, for non-Perl folks, means the same here as try in other languages) – and I might as well have written
my $name = eval { $product->offering->merchant->name };
To keep with reduce, it would have to be something like $a && $a->$b() as the reduce block.
Oliver Steele lives in Western Massachusetts and commutes to downtown LA, where he is bringing an operating system from handwaving to reality. He was the architect of OpenLaszlo, the author of PyWordNet and other open source projects. His interests include programming languages, knowledge representation, information visualization, and math education. [more]
Hmm, now that I come back to look at it with fresh mind, it occurs to me that I led me
reduceabstraction ad absurdum the moment I usedeval(which, for non-Perl folks, means the same here astryin other languages) – and I might as well have writtenmy $name = eval { $product->offering->merchant->name };To keep with
reduce, it would have to be something like$a && $a->$b()as the reduce block.