NAME

    Sub::Declaration - declare subs with named parameters

VERSION

    0.9

SYNOPSIS

    use Sub::Declaration;

    sub mysub($scalar, \@array,) {
        $array[$scalar] += $_ foreach (@_);
    }

    method mymethod($scalar, %hash) {
        print $hash{$scalar}, "\n";
    }

DESCRIPTION

    Sub::Declaration has three purposes:

    *   Allowing subroutines to be declared and defined with a named
        list of arguments, as in most familiar programming languages.

    *   Creating aliases of these parameters to the appropriate
        values.

    *   Allowing methods to be created with automatic declaration of
        the variable containing the object reference.

Why Another Module?

    There are already several modules for handling named subroutine
    parameters, such as Perl6::Parameters, Sub::Parameters, and
    Sub::NamedParams. So why another one? The following reasons:

    *   I wanted to implement the automatic aliasing of the parameters
        to lexical variables, in order to allow Perl's standard
        pass-by-reference to be used when necessary. In particular, I
        wanted to be able to specify that an array or hash reference is
        expected, and set things up so it is not necessary to
        dereference each use of the array or hash.

    *   I wanted an unobtrusive syntax for declaring the parameters.
        If this were all I wanted I'd just have used Perl6::Parameters.
        The syntax for specifying parameters in the other modules just
        struck me as rather clunky.

    *   I wanted to be able to declare methods and have the "$self"
        variable automatically created and populated.

INSTALLATION

    To install this module type the standard incantation:

        perl Makefile.PL
        make
        make test
        make install

DEPENDENCIES

    This module requires these other modules and libraries:

        Filter::Simple
        Lexical::Util
        Symbol

COPYRIGHT AND LICENCE

    Copyright 2004 Kevin Michael Vail

    This program is free software. It may be copied and/or redistributed
    under the same terms as Perl itself.

