Three ways to introduce othogonal behavior: Aspects, Method modifiers, and Subroutine attributes

In my previous post I spoke about what Subroutine attributes are and how to use them. Here I compare them to other techniques for introducing orthogonal behaviors: Method modifiers and Aspects. These three techniques enable to modify what a subroutine does, but they do it in different ways and are thus suited for different needs.

Subroutine attributes: where and how to use them

I watched this video about Subroutine attributes, and I wrote myself a summary of what I learned. I thought I could share it.

Improved autobox-ing. I'm loving it :o)

print (0..9)->grep { $_ > 5 }
            ->map  { $_ * 2 }
            ->join(' - ');

 # prints: 12 - 14 - 16 - 18

Isn’t that nice ? It is now possible with

use autobox::Core;    
use PerlX::MethodCallWithBlock;

The clearest way(s) to check if a List contains...

There is more than one way to do it.Toby Inkster’s Creating your own Perl hits the nail on the head: with Perl you can choose the language that you code in

"So go on; create your own Perl. Make it your gift to yourself."

( Syntax::Collector makes it very simple, and will also help you bundle your “most used modules” - more useful modules in Toby’s article)

Today i’m going to explore one aspect of the Perl language:

how do you check that a list contains a given element?