Class::...entised(3)
π bestie, you've found Class::C3::Componentised π
okay so this is the Class::C3::Componentised(3) page from the User Contributed Perl Documentation β the header is out here doing its little truncation thing as Class::...entised(3), iykyk. π
This one is all about loading mix-ins/components into your C3-based class, and honestly? It's highkey useful. β¨
β¨ NAME β¨
Class::C3::Componentisedβ Load mix-ins or components to your C3-based class. π«Ά
π SYNOPSIS π
okay so here's the vibe in code form, bestie:
package MyModule;
use strict;
use warnings;
use base 'Class::C3::Componentised';
sub component_base_class { "MyModule::Component" }
package main;
MyModule->load_components( qw/Foo Bar/ );
# Will load MyModule::Component::Foo and MyModule::Component::Bar
π¦ DESCRIPTION π¦
So what does it do? It injects base classes to your module using the Class::C3 method resolution order. That's highkey the whole magic trick. πͺ
β οΈ Please note: these are not plugins that can take precedence over methods declared in MyModule. Nope, not that kind of party. If you want something like that, consider MooseX::Object::Pluggable. π«Ά
π METHODS π
load_components( @comps )
Loads the given components into the current module. If a module begins with a "+" character, it is taken to be a fully qualified class name, otherwise "$class->component_base_class" is prepended to it. π
Calling this will call "Class::C3::reinitialize". So yeah, it reinitializes C3 β slay. π
load_own_components( @comps )
Similar to load_components, but assumes every class is "$class::$comp". Cute and specific, love that. π
load_optional_components
As load_components, but will silently ignore any components that cannot be found. Lowkey forgiving. π«Ά
ensure_class_loaded
Given a class name, tests to see if it is already loaded or otherwise defined. If it is not yet loaded, the package is require'd, and an exception is thrown if the class is still not loaded. π
BUG: For some reason, packages with syntax errors are added to%INConrequire.
ensure_class_found
Returns true if the specified class is installed or already loaded, false otherwise. No cap. β
inject_base
Does the actual magic of adjusting @ISA on the target module. πͺ
load_optional_class
Returns a true value if the specified class is installed and loaded successfully, throws an exception if the class is found but not loaded successfully, and false if the class is not installed. π₯
π AUTHORS π
- Matt S. Trout and the DBIx::Class team π«Ά
- Pulled out into separate module by Ash Berlin "<ash@cpan.org>" β¨
- Optimizations and overall bolt-tightening by Peter "ribasushi" Rabbitson "<ribasushi@cpan.org>" π§
πΈ COPYRIGHT πΈ
Copyright (c) 2006 - 2011 the Class::C3::Componentised "AUTHORS" as listed above. π
π LICENSE π
You may distribute this code under the same terms as Perl itself. Periodt. π
π cute little sign-off, bestie: this page came from perl v5.42.0, dated 2018-02-24, and the footer label is Class::...entised(3). mwah! π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Class-C3-Componentised 1.001002-bp160.1.11 Β· Artistic-1.0 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