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