Syntax::Feature::Method - Provide a method keyword
version 0.001
use syntax 'method'; method foo ($n) { $n * $self->bar } my $method = method ($msg) { print "$msg\n"; };
This module will install the Method::Signatures::Simple syntax extension into the requesting namespace.
You can import the keyword multiple times under different names with different options:
use syntax 'method', 'method' => { -as => 'classmethod', -invocant => '$class', };
use syntax method => { -as => 'provide' }; provide addition ($n, $m) { $n + $m }
The -as keyword allows you to install the keyword under a different name. This is especially useful if you want a separate keyword for class methods with a different invocant.
-as
use syntax method => { -invocant => '$me' }; method sum { $me->foo + $me->bar }
Allows you to set a different default invocant. Useful if you want to import a second keyword for class methods that has a $class invocant.
$class
Called by the syntax dispatcher to install the exntension into the requesting package.
syntax, Method::Signatures::Simple
Please report any bugs or feature requests to bug-syntax-feature-method@rt.cpan.org or through the web interface at: http://rt.cpan.org/Public/Dist/Display.html?Name=Syntax-Feature-Method
Robert 'phaylon' Sedlacek <rs@474.at>
This software is copyright (c) 2010 by Robert 'phaylon' Sedlacek.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Syntax::Feature::Method, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Syntax::Feature::Method
CPAN shell
perl -MCPAN -e shell install Syntax::Feature::Method
For more information on module installation, please visit the detailed CPAN module installation guide.