Name : perl-Acme-Sub-Parms
| |
Version : 1.03
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp154.1.1
| Date : 2023-01-27 16:57:19
|
Group : Development/Libraries/Perl
| Source RPM : perl-Acme-Sub-Parms-1.03-lp154.1.1.src.rpm
|
Size : 0.06 MB
| |
Packager : https://www_suse_com/
| |
Summary : Function/Method parameter processing handlers
|
Description :
Acme::Sub::Parms uses a source filter to rewrite the code during the module load with efficient inline parameter processing code that handles some common cases for simple Perl style named parameter key/value parameter lists. It can handle either case-sensitive or case-insensitive parameters as desired.
In essence, it provides some syntactic sugar for parameter declaration and validation.
Typical usage is follows:
sub a_function { BindParms : ( my $somevariable : parameter_name [required]; my $anothervariable : another_parameter_name [optional]; )
}
*IMPORTANT:* The whitespace before and after the \':\' in the \'BindParms : (\' starting declaration *IS NOT* optional.
Second, the entire declaration must be on one line: No line breaks in the middle or other code on the line.
You can make the passed parameter names case insensitive by adding the \':normalize\' option on the \'use\' line.
Acme::Sub::Parms does not handle anonymous hashes for parameters. It expects parameters lists to be passed as \'flat\' lists. This is due to performance issues. The additional code required to handle both \'flat\' and \'anon hash\' parameters has a noticable performance hit for simple cases. Since one of the goals of this module is to be *fast* and a survey of existing modules indicates most authors use \'flat\' parameters lists, that is what Acme::Sub::Parms does as well. If you prefer using anon hashes. just dereference them before using them to call.
Good Example:
some_function(\'a_parm\' => \'value);
sub some_function { BindParms : ( my $variable : a_parm; )
}
Example of dereferencing anon hash parms:
my $parms = { \'a_parm\' => \'value\' }; some_function(%$parms);
Broken Examples:
some_function({ \'a_parm\' => \'value} }); # WILL NOT WORK
my $parms = { \'a_parm\' => \'value\' }; some_function($parms); # WILL NOT WORK
sub some_function { BindParms : ( my $variable : a_parm; )
}
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-A/15.4/noarch |