As the author of one of these, I am arguably biased, so a diligent reader may wish to check the documentation of the relevent modules, and perform their own benchmarking.
Feature | Function-Parameters | Kavorka | Method-Signatures | MooseX-Method-Signatures |
---|---|---|---|---|
Positional parameters | Yes | Yes | Yes | Yes |
Named parameters | Yes | Yes | Yes | Yes |
Long named parameters | No | Yes | No | No |
Slurpy parameters | Yes | Yes | Yes | Yes |
Required parameters | Yes | Yes | Yes | Yes |
Optional parameters | Yes | Yes | Yes | Yes |
Aliased parameters | No | Yes | Yes | No |
Defaults for optional parameters | Yes | Yes | Yes | Yes |
Fine-grained control over when defaults are used | No | Partial (provides //= and ||= )
| Yes | No |
Type constraints | Yes | Yes | Yes | Yes |
Type coercion | No | Yes | Yes | Yes |
Value constraints | No | Yes | Yes | Yes |
Return type constraints | No | Yes | No | Yes |
Return type coercion | No | Yes | No | No |
Allows $_ to be used as a parameter
| No | Yes | No | No |
Allows \@foo to be used as a parameter
| No | Yes | Yes | No |
Can define non-method functions | Yes | Yes | Yes | No |
Method modifiers | No | Yes | Yes | Yes |
Multi methods / multi subs | No | Yes | No | Requires extension (requires MooseX-MultiMethods) |
Anonymous functions / methods | Yes | Yes | Yes | Yes |
Lexical (private) functions / methods | Sort of (you can assign an anonymous function/method to a lexical variable) | Yes | Sort of (you can assign an anonymous function/method to a lexical variable) | Sort of (you can assign an anonymous function/method to a lexical variable) |
Prototypes (like (&@) )
| Yes | Yes | No | No |
Attributes (like :lvalue )
| Yes | Yes | No | No |
Introspection API | Yes | Yes | No | Yes |
Extensible in Pure Perl | No | Yes | Yes | Yes |
Benchmarking results, with Moose | 9732/s | 17598/s | 8980/s | 777/s |
Benchmarking results, with Mouse | 10353/s | 43689/s | 41684/s | 817/s |
Minimum Perl version | 5.14.0 | 5.14.0 | 5.8.8 | 5.8.6 |
Non-core dependencies | 3 | 38 | 40 | 78 |