SPVM::I...ByteList(3)
π NAME π
Okay bestie, meet SPVM::Immutable::ByteList β an Immutable byte Array. This page is SPVM::I...ByteList(3), from User Contributed Perl Documentation, and it's giving βbyte list but make it immutableβ energy. π«Ά
β¨ DESCRIPTION β¨
The Immutable::ByteList has methods to manipulate an immutable byte array. That's the whole vibe: bytes, list, but immutable. Slay. π
π USAGE π
Here's the demo, bestie β verbatim, no cap:
use Immutable::ByteList;
# Create a byte list
my $list = Immutable::ByteList->new;
my $list = Immutable::ByteList->new([(byte)1, 2, 3]);
# Create a byte list with array length
my $list = Immutable::ByteList->new_len(10);
# Get list length
my $length = $list->length;
# Get value.
my $element = $list->get(2);
# Convert list to array.
my $array = $list->to_array;
π¦ FIELDS π¦
length
Field declaration realness:
has length : ro int;
Gets the length field. This field is the length of the elements of the list. Short, iconic, to the point. β¨
π CLASS METHODS π
new
Signature:
static method new : Immutable::ByteList ($array : byte[] = undef);
Creates a new Immutable::ByteList object using new_len. The passed length to new_len is the length of $array. If the array is undef, the length is 0. The elements of $array are copied to the elements of the created array. Copy behavior? Only for the elements, bestie. π
Examples:
my $list = Immutable::ByteList->new;
my $list = Immutable::ByteList->new([(byte)1, 2, 3]);
new_len
Signature:
static method new_len : Immutable::ByteList ($length : int);
Creates a new Immutable::ByteList object with $length.
Exceptions:
$lengthmust be greater than or equal to0. Otherwise an exception is thrown. π
π INSTANCE METHODS π
get
Signature:
method get : int ($index : int);
Gets the element of the position of $index. If $index is a netative value, $index is set to length plus $index. (Yes bestie, βnetativeβ is exactly what the page says β preserve and protect. π«Ά)
Exceptions:
$indexmust be greater than or equal to0. Otherwise an exception is thrown.$indexmust be less than the length of$list. Otherwise an exception is thrown.
to_array
Signature:
method to_array : byte[] ();
Converts the list to an array. Boom, array. π¦
π COPYRIGHT & LICENSE π
Copyright (c) 2023 Yuki Kimoto
MIT License
Final vibe check: this is perl v5.42.2, dated 2026-02-03, manual name SPVM::I...ByteList(3). Bye bestie, go manipulate those immutable bytes responsibly π
β¨
π¦ where this page comes from
- alpine 3.24: spvm-doc 0.990125-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms