Clownf...yteBuf(3pm)

πŸ“¦
version 0.8.0 Β· 3 versions
, in fedora 43, fedora 44

πŸ‘‘ Clownf...yteBuf(3pm) β€” the manual page bestie πŸ’…

okay so this is the user-contributed Perl documentation for Clownfish::ByteBuf, and we're gonna get through it together, no cap. ✨


🌸 NAME 🌸

Clownfish::ByteBuf β€” a growable buffer holding arbitrary bytes. like, any bytes. it does not care. it's giving "I contain multitudes" energy. πŸ¦‹


✨ SYNOPSIS ✨

my $buf = Clownfish::ByteBuf->new($byte_string);
my $byte_string = $buf->to_perl;

πŸŽ€ DESCRIPTION πŸŽ€

soooo the original page literally leaves this section empty. nothing. a void. an empty buffer, if you will 😭 β€” but that's fine, the real tea is all in the constructors and methods below. keep scrolling bestie 🫢


πŸ’– CONSTRUCTORS πŸ’–

🧚 new

my $buf = Clownfish::ByteBuf->new($byte_string);

Create a ByteBuf containing the passed-in bytes. that's it, that's the whole job. iconic. ⭐


πŸ’… METHODS πŸ’…

πŸ“ set_size

$byte_buf->set_size($size);

Resize the ByteBuf to size. but β€” and this is the important part β€” if that's greater than the object's capacity, it throws an error. so don't get bold with it, bestie πŸ’€

🌈 get_size

my $int = $byte_buf->get_size();

Return the size of the ByteBuf in bytes. the actual content length, not the whole allocation.

πŸ’œ get_capacity

my $int = $byte_buf->get_capacity();

Return the number of bytes in the ByteBuf's allocation. so like, the room it has, not the room it's using. very "my closet vs. my outfit" of it πŸŽ€

πŸ”₯ cat

$byte_buf->cat($blob);

Concatenate the contents of Blob blob onto the end of the original ByteBuf. it will allocate more memory as needed, so it just keeps going. main character energy, never runs out of space πŸ’…

πŸ‘‘ yield_blob

my $blob = $byte_buf->yield_blob();

Return the content of the ByteBuf as Blob and clear the ByteBuf. yes, it hands you the goods and then empties itself out. generous. dramatic. obsessed. ✨

πŸ¦‹ utf8_to_string

my $string = $byte_buf->utf8_to_string();

Return a String which holds a copy of the UTF-8 character data in the ByteBuf after checking for validity. so it's the careful one. it checks. it verifies. it does its due diligence 🫢

🌸 trusted_utf8_to_string

my $string = $byte_buf->trusted_utf8_to_string();

Return a String which holds a copy of the UTF-8 character data in the ByteBuf, skipping validity checks. it trusts you. no vibe check. no questions asked 😭

ngl, that's the whole difference between these two β€” one checks, one does not. pick accordingly, bestie.

⭐ compare_to

my $int = $byte_buf->compare_to($other);

Indicate whether one ByteBuf is less than, equal to, or greater than another. the byte contents of the ByteBufs are compared lexicographically.

Throws an exception if other is not a ByteBuf. it said "be a ByteBuf or be gone" πŸ’€

Returns: 0 if the ByteBufs are equal, a negative number if self is less than other, and a positive number if self is greater than other.

πŸ’– clone

my $result = $byte_buf->clone();

Return a clone of the object. twin. duplicate. copy-paste but make it legal πŸŽ€


🌈 INHERITANCE 🌈

Clownfish::ByteBuf isa Clownfish::Obj. so yeah, it's part of the family tree, iykyk 🌳


and that's the whole page, bestie β€” you ate that 🫢 this was pulled from the User Contributed Perl Documentation, brought to you by perl v5.42.3, dated 2026-09-02. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from