| Module Info
| Add a review of Want
Nice module for handling attribute, especially for handling lvalue attribute.
I give 5 starts for the functionality of the module but only 2 for the interface. IMHO, the interface described in Perl6 RFC 21 is better.
Having to test every possibile context instead for 'want' to return the context is asking for 'ugly code' when using this module.
I also dislike subroutines that do very different things depending on the arguments. In one case it returns the context, in another case the number of expected returned elements.
'howmany' doesn't return anything if the number is unknown (list context); does it mean 0 or infinity.
The 'LIST' versus 'ARRAY' is going to surprise a few but I believe it's the right decision.
Want is, as expected, slower than wantarray (20x). This doesn't have any real impact on applications. It is an important point if 'want' is to replace 'wantarray' even for simple cases.
The author asks how his module is going to be used. At first, I will use it to verify that the expected number of returned element matches the arguments my subroutines are asked for. This helps me help my own modules users.
I still think this module is an excellent idea and I am looking forward to give it 5 stars when its interface is more "consistent". Then, I'll be happy to switch completely from 'wantarray' to 'want'
Want provides introspection capabilities for all the context sensitive behaviors present in Perl, in a convenient API. It's a shame that Perl itself doesn't provide the same flexibility in it's core.
One problem with Want, though not directly Want's fault, is that things like Template Toolkit call into Perl space in slightly different ways, and don't provide an op tree to return to, which is how Want does it's magic. In these cases there is a pretty nasty error, so watch out.
The author is also very friendly and helpful (and patient ;-) - without him <plug>Context::Handle</plug> wouldn't be possible...
An excellent module that gives you much greater flexibility with regards to lvalue or rvalue context than core Perl does. This module can end the debate whether to return $self or a value - you can let context decide.
I deducted one point on "Ease of Use" because it crashes the debugger in some cases.