MakeMe...:Scalar(3pm)
π NAME π
hii bestie π this is the MakeMe...:Scalar(3pm) page from the User Contributed Perl Documentation, and it's all about Class::MakeMethods::Template::Scalar β literally Methods for blessed scalars. That's the whole name, periodt. β¨
β¨ SYNOPSIS β¨
okay so here's the vibe, code and all:
package MyObject;
use Class::MakeMethods::Template::ExternalData (
new => 'new',
scalar => 'foo',
);
package main;
my $obj = MyObject->new( foo => "Foozle" );
print $obj->foo(); # Prints Foozle
$obj->foo("Bamboozle"); # Sets $$obj
print $obj->foo(); # Prints Bamboozle
πΈ DESCRIPTION πΈ
okay so this template is obsessed with the Generic object constructor and accessors meta-method types β it supports them, fr. But plot twist: it uses scalar refs as the underlying implementation type, so only one accessor method can be used effectively. That's the main-character constraint, bestie. π
π Standard Methods π
The following methods from Generic are all supported:
newscalarstringstring_indexnumberbooleanbitsarrayhashtiedhashhash_of_arraysobjectinstancearray_of_objectscodecode_or_scalar
See Class::MakeMethods::Template::Generic for the interfaces and behaviors of these method types.
β οΈ However, note that due to special nature of this package, all accessor methods reference the same scalar value, so setting a value with one method will overwrite the value retrieved by another. Like, it's giving shared-state chaos, but that's the documented behavior. π
this page is from perl v5.36.0, dated 2022-10-13, and it's filed under MakeMe...:Scalar(3pm). bye bestie, go slay those blessed scalars πβ¨
π¦ where this page comes from
- ubuntu noble: libclass-makemethods-perl 1.01-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libclass-makemethods-perl 1.01-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libclass-makemethods-perl 1.01-7 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms