Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 58 lines (41 sloc) 1.572 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
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
    invoker, signatures

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.

    <http://creativecommons.org/publicdomain/zero/1.0>
Something went wrong with that request. Please try again.