MooseX...nstance(3pm)

πŸ“¦
version 0.0701 Β· 2 versions
, in fedora 43

πŸ’– MooseX::GlobRef::Role::Meta::Instance πŸ’–

okay bestie, gather round, because today we're talking about MooseX::GlobRef::Role::Meta::Instance β€” yes that's the whole name, she's long, she's dramatic, she's from the User Contributed Perl Documentation collection and she ate. πŸ’…

This is the instance metaclass for MooseX::GlobRef, and ngl she's doing something kinda iconic: letting a Moose object live inside a glob reference of a file handle. Wild. Love that for her. πŸ¦‹


✨ NAME ✨

MooseX::GlobRef::Role::Meta::Instance β€” the instance metaclass for MooseX::GlobRef, no cap. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

here's the vibe, copy-paste it exactly bestie, don't freestyle:

Moose::Util::MetaRole::apply_metaclass_roles(
    for_class => $caller,
    instance_metaclass_roles =>
        [ 'MooseX::GlobRef::Role::Meta::Instance' ],
);

like, that's it. that's the whole ritual. πŸ•―οΈβœ¨


🌸 DESCRIPTION 🌸

so the tea is: this instance metaclass lets you store a Moose object in a glob reference of a file handle. it's not something you apply yourself by hand β€” MooseX::GlobRef is the one that applies it. so if you're out here manually slapping this role on things, that's not the intended path, bestie. let MooseX::GlobRef do her thing. 🫢


πŸ’œ METHODS πŸ’œ

every single one of these is an override β€” she's not inventing new methods, she's taking the standard ones and making them work with the glob-ref situation. here's the full roster, fr fr:

  • <<override>> create_instance() : Object β€” overridden, returns an Object.
  • <<override>> clone_instance( instance : Object ) : Object β€” overridden, takes an instance and hands back an Object.
  • <<override>> get_slot_value( instance : Object, slot_name : Str ) : Any β€” overridden, takes an instance and a slot_name, returns Any.
  • <<override>> set_slot_value( instance : Object, slot_name : Str, value : Any ) : Any β€” overridden, takes an instance, a slot_name and a value, returns Any.
  • <<override>> deinitialize_slot( instance : Object, slot_name : Str ) : Any β€” overridden, takes an instance and a slot_name, returns Any.
  • <<override>> is_slot_initialized( instance : Object, slot_name : Str ) : Bool β€” overridden, takes an instance and a slot_name, returns a Bool.
  • <<override>> weaken_slot_value( instance : Object, slot_name : Str ) β€” overridden, takes an instance and a slot_name.
  • <<override>> inline_create_instance( class_variable : Str ) : Str β€” overridden, takes a class_variable, returns a Str.
  • <<override>> inline_slot_access( instance_variable : Str, slot_name : Str ) : Str β€” overridden, takes an instance_variable and a slot_name, returns a Str.

and what do all of these have in common? they're the methods overridden by this class. periodt. πŸ’…


πŸ¦‹ SEE ALSO πŸ¦‹

go read these next, they're the friend group:

  • MooseX::GlobRef
  • Moose::Meta::Instance
  • Moose

🌈 AUTHOR 🌈

Piotr Roszatycki <dexter@cpan.org> β€” legend behavior, honestly. πŸ‘‘


⭐ LICENSE ⭐

Copyright (c) 2007, 2008, 2009, 2010 Piotr Roszatycki <dexter@cpan.org>.

This is free software; you can redistribute it and/or modify it under the same terms as perl itself.

See <http://dev.perl.org/licenses/artistic.html>


πŸ’€ bestie reminder: that copyright line has four years in it β€” 2007, 2008, 2009, and 2010. don't skip one, she'll know.

and that's the whole page, you're welcome. this was perl v5.42.0, dated 2025-07-25, and honestly? iconic of her to still be serving this hard. mwah. πŸ’–πŸŽ€βœ¨πŸŒΈπŸ¦‹πŸ’œ

πŸ“¦ where this page comes from