Clownfish::Class(3pm)
π NAME π
Clownfish::Class β it's giving Class. that's it, that's the name, bestie π
β¨ SYNOPSIS β¨
okay so like, here's the vibe in code form:
my $class = Clownfish::Class->fetch_class('Foo::Bar');
my $subclass = Clownfish::Class->singleton('Foo::Bar::Jr', $class);
π¦ DESCRIPTION π¦
so in Clownfish, classes are literally first-class objects. main character energy fr fr. and those Class objects? they're instances of Clownfish::Class. it's classes all the way down, no cap π
πΈ CONSTRUCTORS πΈ
π fetch_class
my $class = Clownfish::Class->fetch_class($class_name);
goes and finds a class that's already registered. heads up though β it might hand you back undef if that class isn't registered. so like, check it, bestie π
π singleton
my $class = Clownfish::Class->singleton(
class_name => $class_name, # required
parent => $parent, # required
);
returns a singleton, iconic behavior honestly. if a Class can be found in the registry based on the class name you gave it, that's the one you get back. but if it can't? a brand new Class gets created, using parent as its base. β¨
ok so important: ifparentisundef, it'll try to go find it. and if that attempt fails? error time, babes. π
π METHODS π
β make_obj
my $obj = $class->make_obj();
makes you an empty object of whatever type the Class defines. it allocates it, assigns its class, and gives it an initial refcount of 1. but bestie, the caller is responsible for initialization β it doesn't do that part for you, k? π«Ά
β get_name
my $string = $class->get_name();
hands you back the name of the class. simple, clean, slay.
β get_parent
my $result = $class->get_parent();
returns the parent class. or undef if you're at a root of the class hierarchy β like, the OG, no parents, generational wealth of being the top π§
β get_obj_alloc_size
my $int = $class->get_obj_alloc_size();
tells you the number of bytes needed to hold an instance of the class. numbers girlies rise up π₯
π INHERITANCE π
Clownfish::Class isa Clownfish::Obj. the family tree is giving... tree π
and that's the whole page, bestie!! this was documented in perl v5.42.3, dated 2026-09-02, and yeah it's a User Contributed Perl Documentation situation. mwah π
π¦ 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