NAME Params::Smart - use both positional and named arguments in a subroutine REQUIREMENTS The following non-core modules are required: Regexp::Common INSTALLATION Installation can be done using the traditional Makefile.PL or the newer Build.PL methods. Using Makefile.PL: perl Makefile.PL make test make install (On Windows platforms you should use `nmake' instead.) Using Build.PL (if you have Module::Build installed): perl Build.PL perl Build test perl Build install SYNOPSIS use Params::Smart 0.04; sub my_sub { %args = Params(qw( foo bar ?bo ?baz ))->args(@_); ... } my_sub( foo=> 1, bar=>2, bo=>3 ); # call with named arguments my_sub(1, 2, 3); # same, with positional args DESCRIPTION This module provides "smart" parameter handling for subroutines without having to use a changed syntax or source filters. Features include: * Mixed use of named and positional parameters. * Type checking and coercion through callbacks. * Dyanmic paramaters configured from callbacks. * Memoization of the Simple Paramater Templates entry elsewhere in this document. Compatability with Previous Versions Note that the formatting for simple parameter templaces has changed since version 0.03, and the complex paramater templates were not implemented until version 0.04, so it is best to specify a minimum version in use statements use Params::Smart 0.04; head1 REVISION HISTORY A brief list of changes since the previous release: 0.05 Fri May 6 2005 - removed links to module manpages because the pod2text function stupidly changes L to "the Module manpage" - fixed bug that caused warnings in Regexp::Common - redid POD to use Pod::Readme - updated SEE ALSO section For a detailed history see the Changes file included in this distribution. CAVEATS *This is an experimental module, and the interface may change.* More likely additional features will be added. SEE ALSO This module is superficially similar in function to Getargs::Mixed but does not require named parameters to have an initial dash ('-'). Class::NamedParams provides a framework for implementing named parameters in classes. Sub::NamedParams will create a named-parameter wrapper around subroutines which use positional parameters. The syntax of the paramater templates is inspired by Perl6::Subs, though not necessarily compatible. (See also *Apocalypse 6* in Perl6::Bible). Sub::Usage inspired the error-messages returned by calls to arg(). Params::Validate is useful for (additional) parameter validation beyond what this module is capable of. Class::ParmList provides a framework for paramater validation as well. AUTHOR Robert Rothenberg Suggestions and Bug Reporting Feedback is always welcome. Please use the CPAN Request Tracker at http://rt.cpan.org to submit bug reports. LICENSE Copyright (c) 2005 Robert Rothenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.