Rose::Class(3pm)
π Rose::Class π
okay bestie, welcome to Rose::Class β it's a very simple class base class, and no, that's not a typo, that's literally the whole vibe. it's giving "user contributed perl documentation" energy and honestly? iconic. π
β¨ SYNOPSIS β¨
here's the whole thing in action, no cap:
package MyClass;
use Rose::Class;
our @ISA = qw(Rose::Class);
sub foo { ... }
...
MyClass->foo(...) or die MyClass->error;
...
see how we use Rose::Class, drop it in @ISA, do our little foo thing, and then check MyClass->error when stuff goes sideways? that's the whole relationship. π«Ά
πΈ DESCRIPTION πΈ
so like, Rose::Class is a generic base class for classes. it hands you exactly one class method (error), and it might get more stuff later β it "may be expanded further in the future" β so don't come for it, it's growing. π±
here's the part you need to actually internalize though, bestie: a class that inherits from Rose::Class is not expected to allow objects of that class to be instantiated, because the namespace for class methods and object methods is shared. it's one namespace, one house, everybody living in it. π
for example β and this is the classic case β it's common for Rose::Object-derived classes to have their own error methods. but that would conflict with the Rose::Class method of the same name. two errors, one namespace, absolutely not the moment. π
π CLASS METHODS π
error [ERROR]β get or set the class-wide error. by convention this should be a scalar that stringifies to an error message, and the most commonly used value is just a simple scalar containing a string. like, a plain string. that's it. that's the whole thing. simple, clean, slay. β¨
π¦ AUTHOR π¦
John C. Siracusa (siracusa@gmail.com) β king behavior, honestly. π
π LICENSE π
Copyright (c) 2010 by John C. Siracusa. All rights reserved. this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. periodt. π
π and that's the page, bestie β go forth and set your class-wide errors responsibly. π
this was perl v5.34.0, dated 2022-05-28, signing off from the Rose::Class(3pm) corner of the internet πβ¨π¦
π¦ where this page comes from
- debian bookworm: librose-object-perl 0.860-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: librose-object-perl 0.860-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: librose-object-perl 0.860-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: librose-object-perl 0.860-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: librose-object-perl 0.860-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms