Array:...Fields(3pm)
β¨ NAME β¨
Array::IntSpan::Fields β an IntSpan array that uses integer fields as its indices π
(yes bestie, this is the one from the User Contributed Perl Documentation section of the manual, filed under Array:...Fields(3pm) β you're in the right place π«Ά)
πΈ SYNOPSIS πΈ
use Array::IntSpan::Fields;
my $foo = Array::IntSpan::Fields
->new( '1.2.4',
['0.0.1','0.1.0','ab'],
['1.0.0','1.0.3','cd']);
print "Address 0.0.15 has ".$foo->lookup("0.0.15").".\n";
$foo->set_range('1.0.4','1.1.0','ef') ;
π¦ DESCRIPTION π¦
So Array::IntSpan::Fields is literally just Array::IntSpan but with the glow-up of taking indices made out of integer fields β think an IP address, or an ANSI SS7 point code. Same iconic energy, fancier index π
The number of integers and their maximum value get locked in the moment you call the constructor (or when you call the set_format method). Look at the example up in the synopsis: it defines an indice with 3 fields, and their maximum values are 1, 3, 15 (that's 0x1, 0x3, 0xf if you speak hex, and you should, you're doing great) β¨
What's actually happening under the hood? This module converts the fields into plain integers before it hands them off to the Array::IntSpan module. That's it, that's the whole trick. No cap π₯
π CONSTRUCTOR π
new (...)
The very first parameter sets the size of the integer of the fields, measured in number of bits. So for an IP address, your field definition would be 8,8,8,8. Periodt π
π METHODS π
Every single method that Array::IntSpan has is available here. All of them. The whole squad π«Ά
set_format( field_description )
This one lets you set a whole different field description. But listen β beware: no conversion happens, no checking happens. None. Zero. Zilch. So when you switch up the format, your old indices may just become straight-up illegal. It's giving consequences, bestie π
int_to_field ( integer )
Hand it an integer, and it returns the field representation of that integer. Cute, right? π
field_to_int ( field )
Hand it a field, and it returns the integer value of that field. Heads up though: it may craok if the field values are too great with respect to the filed description π
π AUTHOR π
Dominique Dumont, ddumont@cpan.org π
Copyright (c) 2003 Dominique Dumont. All rights reserved.
This module is distributed under the Artistic 2.0 License. See https://www.perlfoundation.org/artistic-license-20.html for the whole thing π
aaaand that's the whole page, bestie π this manual came to you courtesy of perl v5.34.0, dated 2022-05-27, and it says Array:...Fields(3pm) right there at the bottom too. go forth and index some fields, you absolute icon π¦β¨
π¦ where this page comes from
- debian bookworm: libarray-intspan-perl 2.004-2 Β· Artistic-2.0
- debian trixie: libarray-intspan-perl 2.004-2 Β· Artistic-2.0
- ubuntu noble: libarray-intspan-perl 2.004-2 Β· Artistic-2.0
- ubuntu resolute: libarray-intspan-perl 2.004-2 Β· Artistic-2.0
- ubuntu stonking: libarray-intspan-perl 2.004-2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms