1Class::C3::ComponentiseUds(e3r)Contributed Perl DocumentCaltaisosn::C3::Componentised(3)
2
3
4
6 Class::C3::Componentised - Load mix-ins or components to your C3-based
7 class
8
10 package MyModule;
11
12 use strict;
13 use warnings;
14
15 use base 'Class::C3::Componentised';
16
17 sub component_base_class { "MyModule::Component" }
18
19 package main;
20
21 MyModule->load_components( qw/Foo Bar/ );
22 # Will load MyModule::Component::Foo and MyModule::Component::Bar
23
25 This will inject base classes to your module using the Class::C3 method
26 resolution order.
27
28 Please note: these are not plugins that can take precedence over
29 methods declared in MyModule. If you want something like that, consider
30 MooseX::Object::Pluggable.
31
33 load_components( @comps )
34 Loads the given components into the current module. If a module begins
35 with a "+" character, it is taken to be a fully qualified class name,
36 otherwise "$class->component_base_class" is prepended to it.
37
38 Calling this will call "Class::C3::reinitialize".
39
40 load_own_components( @comps )
41 Similar to load_components, but assumes every class is "$class::$comp".
42
43 load_optional_components
44 As load_components, but will silently ignore any components that cannot
45 be found.
46
47 ensure_class_loaded
48 Given a class name, tests to see if it is already loaded or otherwise
49 defined. If it is not yet loaded, the package is require'd, and an
50 exception is thrown if the class is still not loaded.
51
52 BUG: For some reason, packages with syntax errors are added to %INC on
53 require
54
55 ensure_class_found
56 Returns true if the specified class is installed or already loaded,
57 false otherwise.
58
59 inject_base
60 Does the actual magic of adjusting @ISA on the target module.
61
62 load_optional_class
63 Returns a true value if the specified class is installed and loaded
64 successfully, throws an exception if the class is found but not loaded
65 successfully, and false if the class is not installed
66
68 Matt S. Trout and the DBIx::Class team
69
70 Pulled out into separate module by Ash Berlin "<ash@cpan.org>"
71
72 Optimizations and overall bolt-tightening by Peter "ribasushi"
73 Rabbitson "<ribasushi@cpan.org>"
74
76 Copyright (c) 2006 - 2011 the Class::C3::Componentised "AUTHORS" as
77 listed above.
78
80 You may distribute this code under the same terms as Perl itself.
81
82
83
84perl v5.32.0 2020-07-28 Class::C3::Componentised(3)