Rose::Object(3pm)

πŸ“¦
version 0.860 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Rose::Object β€” the manual, but make it cute ✨

okay bestie, this is Rose::Object, a page from the User Contributed Perl Documentation collection πŸŽ€ and honestly? it's giving "tiny but mighty." it's a simple object base class. that's the whole vibe. let's get into it 🫢


✨ NAME ✨

Rose::Object β€” a simple object base class. yes bestie, that's it, that's the name, short and iconic πŸ‘‘


🌸 SYNOPSIS 🌸

here's how you use it, copy-paste style, no cap:

package MyObject;

use Rose::Object;
our @ISA = qw(Rose::Object);

sub foo { ... }
sub bar { ... }
...

my $o = MyObject->new(foo => 'abc', bar => 5);
...

literally that's all you need to start being a main character with your own class πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so Rose::Object is a generic object base class. it does not come with a whole buffet of features β€” it provides very little functionality, but a healthy dose of convention 🌈. and honestly? that's the point. lowkey minimal, highkey useful.


πŸ‘‘ METHODS πŸ‘‘

🌟 new PARAMS

constructs a new, empty, hash-based object based on PARAMS πŸŽ€

and what are PARAMS? they're name/value pairs, bestie. then it calls init (scroll down, it's right there πŸ‘‡) and passes PARAMS to it unmodified β€” no edits, no notes, no touching, fr fr.

🌟 init PARAMS

you hand it a list of name/value pairs in PARAMS, and it calls the object method of each name, passing the corresponding value along as an argument ✨

the methods get called in the order that they appear in PARAMS β€” order matters, periodt πŸ’…

like, for example:

$o->init(foo => 1, bar => 2);

is equivalent to this exact sequence:

$o->foo(1);
$o->bar(2);

see? foo first, then bar. in that order. no skipping ahead πŸ™ˆ


πŸ’œ AUTHOR πŸ’œ

John C. Siracusa (siracusa@gmail.com) β€” thank you for your service, king 🫢


πŸŽ€ 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 🌸

bestie, that's the legal bit β€” keep it, it's not optional πŸ’€

and that's the whole page!! slay ✨ this was Rose::Object, from perl v5.34.0, dated 2022-05-28 πŸ’– go forth and inherit responsibly, i love you, bye πŸ¦‹πŸŽ€πŸ‘‘

πŸ“¦ where this page comes from