Name : perl-Perl6-Placeholders
| |
Version : 0.07
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp154.7.1
| Date : 2023-01-27 17:49:32
|
Group : Development/Libraries/Perl
| Source RPM : perl-Perl6-Placeholders-0.07-lp154.7.1.src.rpm
|
Size : 0.01 MB
| |
Packager : https://www_suse_com/
| |
Summary : Perl 6 implicitly declared parameters for Perl 5
|
Description :
The Perl6::Placeholders module lets you try out the new Perl 6 implicit parameter specification syntax in Perl 5.
Perl 6 reserves all variables of the form \'$^name\' or \'AATT^name\' or \'%^name\' as \"placeholders\" that can be used to turn regular blocks into subroutine references.
Any block containing one or more such placeholders is treated as a reference to a subroutine in which the placeholders are replaced by the appropriate number and sequence of arguments.
That is, the expression:
$check = { $^a == $^b**2 * $^c or die $^err_msg };
is equivalent to:
$check = sub ($a, $b, $c, $err_msg) { $a == $b**2 * $c or die $err_msg };
This could then be invoked:
$check.($i,$j,$k,$msg);
It is also be possible to interpolate an argument list into a static expression like so:
{ $^a == $^b**2 * $^c or die $^err_msg }.($i,$j,$k,$msg);
The placeholders are sorted UTF8-abetically before they are used to create the subroutine\'s parameter list. Hence the following:
AATTreverse_sorted = sort {$^b < => $^a} AATTlist;
works as expected. That is, it\'s equivalent to:
AATTreverse_sorted = sort sub($a,$b){$b < => $a}, AATTlist;
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-P/15.4/noarch |