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 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 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 "Simple Paramater Templates". See the module documentation for more information. REVISION HISTORY Changes since previous release: 0.04 Thu Apr 28 2005 - rewrote documentation - uses Regexp::Common - defaults can have double-quote-delimited strings - changed format of error messages - added friendlier usage message on error - parameter name aliases allowed - callbacks can modify parameters - use custom memoization due to issues with callbacks - implemented callbacks - misc optimizations/tweaks - added hashref params as alternative to strings - added parse_param and set_param methods - additional information documented - fixed formatting mistake in POD See the Changes file included with the 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 ('-'). 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. AUTHOR Robert Rothenberg Suggestions and Bug Reporting Feedback is always welcome. Please use the CPAN Request Tracker at 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.