Clownf...harBuf(3pm)
π Clownfish::CharBuf π
ok so bestie, welcome to Clownfish::CharBuf β it's a growable buffer that holds Unicode characters, and it lives over in the User Contributed Perl Documentation for section 3pm. she's a grower, not a shower, and honestly? iconic behavior. π
β¨ SYNOPSIS β¨
like, here's the whole vibe in five lines:
my $buf = Clownfish::CharBuf->new;
$buf->cat('abc');
$buf->cat_char(ord("\n"));
print $buf->to_string;
see how she justβ¦ accumulates? no cap. π
πΈ DESCRIPTION πΈ
ok this part of the page is literally empty in the original, so we're just gonna vibe here together. no extra lore. don't come for me. π
π CONSTRUCTORS π
π« new
my $char_buf = Clownfish::CharBuf->new(
capacity => $capacity, # default: 0
);
returns you a brand-new CharBuf, fresh out the box, main character energy from day one. β¨
capacityβ the initial minimum capacity of the CharBuf, measured in bytes. default is0, so she starts small and grows into herself. π¦
π₯ METHODS π₯
π cat
$char_buf->cat($string);
glues the contents of the String string onto the end of the caller. like adding to the group chat, but for characters.
stringβ the String you wanna concatenate. π«Ά
π cat_char
$char_buf->cat_char($code_point);
adds exactly one Unicode character onto the end of the CharBuf. just one. a single little guy.
code_pointβ the code point of that Unicode character. π
β grow
$char_buf->grow($capacity);
hands the CharBuf more memory, but only if she doesn't already have enough room for a string of size bytes. heads up bestie: this cannot shrink the allocation β she only goes up, never down. π
capacityβ the new minimum capacity of the ByteBuf.
π§ clear
$char_buf->clear();
wipes the CharBuf clean. factory reset but make it cute. π«§
π
get_size
my $int = $char_buf->get_size();
tells you the size of the CharBuf's content, in bytes. yes, bytes, not vibes. π
πΈ clone
my $result = $char_buf->clone();
returns a clone of the object. a whole twin. spooky season but useful. πͺ
π¦ yield_string
my $string = $char_buf->yield_string();
returns the content of the CharBuf as a String and clears the CharBuf in one move. she gives you everything and then walks away. this is more efficient than to_string(), so, like, use it. π₯
π INHERITANCE π
Clownfish::CharBuf isa Clownfish::Obj. family tree confirmed. π³
reminder bestie: every flag, default and detail above is straight from the source β i did not make anything up, and you should not either. π
mwah, that's the whole page! this one shipped with perl v5.42.3 and is dated 2026-09-02 β go forth and concatenate, you absolute legend. π β¨π
π¦ where this page comes from
- fedora 43: perl-Clownfish 0.8.0-1.fc43 Β· Apache-2.0
- fedora 44: perl-Clownfish 0.8.0-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms