MooseX...eClass(3pm)

πŸ’– MooseX::Types::LoadableClass πŸ’–

okay bestie, welcome to the User Contributed Perl Documentation for MooseX::Types::LoadableClass, and trust me, this one is a whole vibe. it's a ClassName type constraint that coerces into actually loading the class. no cap. πŸ’…


✨ NAME ✨

MooseX::Types::LoadableClass β€” ClassName type constraint with coercion to load the class. πŸŽ€


🌸 VERSION 🌸

version 0.016 β€” yes, the number matters, don't @ me.


πŸ¦‹ SYNOPSIS πŸ¦‹

like, look how cute this is:

package MyClass;
use Moose;
use MooseX::Types::LoadableClass qw/ LoadableClass /;

has foobar_class => (
    is => 'ro',
    required => 1,
    isa => LoadableClass,
);

MyClass->new(foobar_class => 'FooBar'); # FooBar.pm is loaded or an
                                        # exception is thrown.

so you hand it the string 'FooBar', and it goes and loads FooBar.pm for you. if that fails? exception. thrown. immediately. no survivors. 😭


πŸ’œ DESCRIPTION πŸ’œ

the origin story, fr fr:

use Moose::Util::TypeConstraints;

my $tc = subtype as ClassName;
coerce $tc, from Str, via { Class::Load::load_class($_); $_ };

the author literally says: "I've written those three lines of code quite a lot of times, in quite a lot of places."

and then: "Now I don't have to."

periodt. that's the whole motivation. iconic behavior honestly. πŸ‘‘


🫢 TYPES EXPORTED 🫢

"LoadableClass"

a normal class / package. that's it. that's the type. simple, clean, slay. ✨

"LoadableRole"

like "LoadableClass", except the loaded package must be a Moose::Role. so if you try to sneak a regular class in there, it's not gonna fly, bestie. 🚫


πŸŽ€ SUPPORT πŸŽ€

found a bug? (rude, but okay.) bugs may be submitted through the RT bug tracker here:

https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Types-LoadableClass

or you can email bug-MooseX-Types-LoadableClass@rt.cpan.org πŸ’Œ

there's also a mailing list for users of this distribution, hanging out at http://lists.perl.org/list/moose.html 🌈

and there's an irc channel too, for the real ones: "#moose" on "irc.perl.org" β€” irc://irc.perl.org/#moose πŸ’¬


πŸ‘‘ AUTHOR πŸ‘‘

Tomas Doran <bobtfish@bobtfish.net> β€” the main character who wrote this. πŸ’–


🌟 CONTRIBUTORS 🌟

these legends showed up and helped:

  • Karen Etheridge <ether@cpan.org>
  • Dagfinn Ilmari MannsΓ₯ker <ilmari@ilmari.org>
  • Florian Ragwitz <rafl@debian.org>
  • Graham Knop <haarg@haarg.org>
  • Gregory Oschwald <goschwald@maxmind.com>
  • Π‘Π΅Ρ€Π³Π΅ΠΉ Π ΠΎΠΌΠ°Π½ΠΎΠ² <sromanov@cpan.org>

not me being obsessed with the whole squad πŸ₯Ή


This software is copyright (c) 2010 by Infinity Interactive, Inc.

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 go wild, legally. πŸ’…


and that's the whole page, bestie!! πŸŽ€ this was perl v5.40.1, dated 2025-04-24, and it's genuinely giving iconic manpage energy. go load some classes. iykyk. πŸ¦‹πŸ’–βœ¨

πŸ“¦ where this page comes from