MooseX...struct(3pm)

πŸ“¦
version 1.01 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– NAME πŸ’–

okay so in your man reader this page shows up as MooseX...struct(3pm), and the actual module behind it is MooseX::Blessed::Reconstruct β€” it's a Data::Visitor whose whole job is creating Moose objects out of blessed placeholders. bestie it's giving magic ✨


πŸŽ€ VERSION πŸŽ€

version 1.01 🫢 yes we're on 1.01, no notes.


πŸ¦‹ SYNOPSIS πŸ¦‹

use MooseX::Blessed::Reconstruct;

my $obj = bless( {
        init_arg_foo => "Blah",
        arf => "yay",
}, "Foo" );

my $proper = MooseX::Blessed::Reconstruct->new->visit($obj);

# equivalent to:

my $proper = Foo->meta->new_object(%$obj);

# but recursive (and works with shared references)

🌸 DESCRIPTION 🌸

so the entire purpose of this module is to "fix up" blessed data and turn it into a real, actual, living-and-breathing Moose object. that's the mission. that's the whole vibe. πŸ’…


✨ METHODS ✨

go check out Data::Visitor, that's where the family lives, iykyk.

🧚 new

Constructor. periodt.

arguments

  • load_classes β€” if it's true (and it is the default, obvi), we try to require its class whenever the target object gets visited. ✨

πŸ“ load_classes

a read/write accessor for the load_classes attribute. if it's true, we try to require its class whenever a target object is visited. same energy, different door. πŸšͺ

🌈 visit_object $object

calls load_class in Class::MOP on the ref of $object.

if there's a metaclass, it calls visit_object_with_meta; if not, visit_ref gets deployed to walk the object brutishly. 😭 iconic honestly.

returns a deep clone of the input structure, with all the Moose objects reconstructed "properly".

πŸ‘‘ visit_object_with_meta $obj, $meta

takes the metaclass $meta, uses it to create a new instance, registers that instance with Data::Visitor's cycle tracking, and then inflates it using new_object in Moose::Meta::Class. slay.

πŸ’œ prepare_args $obj

collapses $obj down into key value pairs, ready to be used as init args to new_object in Moose::Meta::Class. little squish, big purpose. 🫢


πŸŽ€ AUTHORS πŸŽ€

  • Yuval Kogman <nothingmuch@woobling.org>
  • Jonathan Rockway <jrockway@cpan.org>
  • Yanick Champoux <yanick@cpan.org>

the girls that get it, get it. πŸ’–


this software is copyright (c) 2018, 2014 by Infinity Interactive, Yuval Kogman.

this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

so yeah, free as in go off, bestie β€” same terms as Perl 5 itself, no cap.

okay that's the whole page!! πŸ¦‹ this was generated under perl v5.28.1, dated 2018-12-21, and honestly? it ate. πŸ’…βœ¨

πŸ“¦ where this page comes from