Name : perl-Params-Smart
| |
Version : 0.08
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp155.7.1
| Date : 2023-07-20 17:18:52
|
Group : Development/Libraries/Perl
| Source RPM : perl-Params-Smart-0.08-lp155.7.1.src.rpm
|
Size : 0.03 MB
| |
Packager : https://www_suse_com/
| |
Summary : use both positional and named arguments in a subroutine
|
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.
Usage is as follows:
sub my_sub { %vals = Params( AATTtemplate )->args( AATTargs ); ... }
The C< AATTtemplate> specifies the names of parameters in the order that they should be given in subroutine calls, and C< AATTargs> is the list of argument to be parsed: usually you just specify the void list C< AATT_>.
The keys in the returned hash C< %vals> are assigned to the appropriate arguments, irrespective of calling style.
Names may be called with an optional initial dash, as with L< Getargs::Mixed>:
my_sub( -first => 1, -second => 2 );
Smart parameters can be used for method calls:
sub my_method { my $self = shift; %vals = Params( AATTtemplate )->args( AATTargs ); ... }
The values may also contain additional keys which begin with an underscore. These are internal/diagnostic values:
* _named
True if the parameters were treated as named, false if positional. See L< /CAVEATS> below.
To improve performance, C< Params> memoizes parameter templates when they are parsed, based on where the call to C< Params> was made.
This may be problematic if templates are changed dynamically. To override memoization, use ParamsNC function:
%vals = ParamsNC( AATTtemplate )->args( AATT_ );
There are two styles of templates, L< /Simple Parameter Templates> with a Perl6-like syntax, and L< /Complex Parameter Templates> which allow more options to be specified using hashes.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-P/15.5/noarch |