-
-
30 Jan 2013 15:45:46 UTC
- Distribution: methods
- Module version: 0.12
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Issues (1)
- Testers (1723 / 7 / 0)
- Kwalitee
Bus factor: 2- 100.00% Coverage
- License: unrestricted
- Perl: v5.8.0
- Activity
24 month- Tools
- Download (28.23KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Method::Signatures::Simple
- invoker
- namespace::sweep
- true::VERSION
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
methods - Provide method syntax and sweep namespaces
SYNOPSIS
use methods; # with signature method foo($bar, %opts) { $self->bar(reverse $bar) if $opts{rev}; } # attributes method foo : lvalue { $self->{foo} } # change invocant name method foo ($class: $bar) { $class->bar($bar) } # "1;" no longer required here
With invoker support:
use methods-invoker; method foo() { $->bar(); # Write "$self->method" as "$->method" }
DESCRIPTION
This module uses Method::Signatures::Simple to provide named and anonymous methods with parameters, except with a shorter module name.
It also imports namespace::sweep so the
method
helper function (as well as any imported helper functions) won't become methods in the importing module.Finally, it also imports true so there's no need to put
1;
in the end of the importing module anymore.OPTIONS
If the first argument on the
use
line is-invoker
, then it also imports invoker automatically so one can write$self->method
as$->method
.Other arguments are passed verbatim into Method::Signatures::Simple's
import
function.SEE ALSO
AUTHORS
唐鳳 <cpan@audreyt.org>
CC0 1.0 Universal
To the extent possible under law, 唐鳳 has waived all copyright and related or neighboring rights to methods.
This work is published from Taiwan.
Module Install Instructions
To install methods, copy and paste the appropriate command in to your terminal.
cpanm methods
perl -MCPAN -e shell install methods
For more information on module installation, please visit the detailed CPAN module installation guide.