MakeMe...:Struct(3pm)
π NAME π
Class::MakeMethods::Emulator::Struct β Emulate Class::Struct π
okay bestie, you're reading MakeMe...:Struct(3pm) from the User Contributed Perl Documentation, and this whole page is about Class::MakeMethods::Emulator::Struct, the emulator for Class::Struct β¨
β¨ SYNOPSIS β¨
use Class::MakeMethods::Emulator::Struct;
struct (
simple => '$',
ordered => '@',
mapping => '%',
obj_ref => 'FooObject'
);
this is the whole call, and yes it's giving "drop it in and go" energy π
πΈ DESCRIPTION πΈ
so the tea is: this module emulates the functionality of Class::Struct by munging the provided field-declaration arguments to match those expected by Class::MakeMethods π«Ά
it supports:
- the same four types of accessors β you can spot them in the
structcall above π - the choice of array-based or hash-based objects
- the choice of installing methods in the current package or a specified target
π EXAMPLE π
the three declarations below create equivalent methods for a simple hash-based class with a constructor and four accessors π
use Class::Struct;
struct (
simple => '$',
ordered => '@',
mapping => '%',
obj_ref => 'FooObject'
);
use Class::MakeMethods::Emulator::Struct;
struct (
simple => '$',
ordered => '@',
mapping => '%',
obj_ref => 'FooObject'
);
use Class::MakeMethods (
-MakerClass => 'Standard::Array',
'new' => 'new',
'scalar' => 'simple',
'array -auto_init 1' => 'ordered',
'hash -auto_init 1' => 'mapping',
'object -auto_init 1' => '-class FooObject obj_ref'
);
same methods, three different spellings β slay π«
π COMPATIBILITY π
this module aims to offer a "95% compatible" drop-in replacement for the core Class::Struct module for purposes of comparison and code migration π
the class-struct.t test for the core Class::Struct module is included with this package. the test is unchanged except for a direct substitution of this emulator's name in the place of the core module π§
but bestie, hear me: there are numerous internal differences between the methods generated by the original Class::Struct and this emulator, and some existing code may not work correctly without modification π no cap.
π¦ SEE ALSO π¦
Class::MakeMethodsβ general information about this distribution πClass::MakeMethods::Emulatorβ more about this family of subclasses πΈClass::Structβ documentation of the original module πClass::MakeMethods::Standard::HashandClass::MakeMethods::Standard::Arrayβ documentation of the created methods π
mwah π this page came from perl v5.36.0 and is dated 2022-10-13 β bye bestie, go slay your structs π«Ά
π¦ 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