NAME

Syntax::Feature::Method - Provide a method keyword

VERSION

version 0.001

SYNOPSIS

use syntax 'method';

method foo ($n) { $n * $self->bar }

my $method = method ($msg) { 
    print "$msg\n";
};

DESCRIPTION

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',
    };

OPTIONS

-as

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.

-invocant

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.

METHODS

install

Called by the syntax dispatcher to install the exntension into the requesting package.

SEE ALSO

syntax, Method::Signatures::Simple

BUGS

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

AUTHOR

Robert 'phaylon' Sedlacek <rs@474.at>

COPYRIGHT AND LICENSE

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.