NAME
Params::Smart - use both positional and named arguments in a subroutine
(deprecated)
REQUIREMENTS
The following non-core modules are required:
Regexp::Common
INSTALLATION
Installation can be done using the traditional Makefile.PL method:
perl Makefile.PL
make test
make 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
STATUS
This module is deprecated.
It has had no significant updates since 2007.
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 parameters configured from callbacks.
* Memoization of parameter templates.
Compatability with Previous Versions
Note that the formatting for simple parameter templates has changed
since version 0.03, and the complex parameter 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;
0.08 Wed Mar 21 2007
- added case where undef value used in positional parameter
(thanks to Rick Westerman)
- minor reorganization of POD
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 parameter 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 parameter validation as well.
AUTHOR
Robert Rothenberg <rrwo@cpan.org>
Suggestions and Bug Reporting
Feedback is always welcome. Please use the CPAN Request Tracker at
http://rt.cpan.org to submit bug reports.
There is a git repository at
https://github.com/robrwo/perl-Params-Smart.
LICENSE
Copyright (c) 2005-2007, 2025 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.