Name : perl-Acme-Hyperindex
| |
Version : 0.12
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp155.9.1
| Date : 2023-07-20 17:16:28
|
Group : Development/Libraries/Perl
| Source RPM : perl-Acme-Hyperindex-0.12-lp155.9.1.src.rpm
|
Size : 0.01 MB
| |
Packager : https://www_suse_com/
| |
Summary : Look deep into structures using a list of indexes
|
Description :
When you use dynamic datastructures, the perl index syntax may not be felxible enough. A little examle:
my AATTstruct = ( { pion => [ [qw(strange j_psi positron)], [qw(down_squark electron gluino)], ], w_plus_wino => [ [qw(neutralino tau kaon)], [qw(charm_squark photino strange_squark)] ], }, );
Now to get to the kaon particle, normally we use:
my $particle = $struct[0]->{w_plus_wino}->[2]; -- or better -- my $particle = $struct[0]{w_plus_wino}[2];
But what if you don\'t know how deep your datastructure is at compile time? \'Course this is doable:
my $particle = \\AATTstruct; $particle = $particle->[$_] for qw(0 pion 2);
Two problems here: Perl will tell you \'Not an ARRAY reference\' once we try to index in the hash on \'pion\' with this array indexing syntax. It\'s damn ugly and looks complicated.
So Acme::Hyperindex lets you index arbitrary deep into data structures:
my $particle = AATTstruct[[ 0, \'pion\', 2 ]]; -- or even -- my $particle = AATTstruct[[ AATTindexes ]]; -- or -- my $particle = AATTstruct[[ get_index() ]]; -- or -- my $particle = AATTstruct[[ $particleindexes[[ 3, 42 ]] ]];
Acme::Hyperindex now also lets you index on scalars, arrays and hashes:
$struct[[ ... ]]; AATTstruct[[ ... ]]; %struct[[ ... ]];
And lists ary auto-derefed in list context:
my $struct = [ [qw(a b c)], [qw(d e f)] ];
my $foo = $struct[[ 0 ]]; # $foo contains a ref to qw(a b c) my AATTfoo = $struct[[ 0 ]]; # AATTfoo contains qw(a b c)
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-A/15.5/noarch |