README
1NAME
2 Module::Pluggable::Ordered - Call module plugins in a specified order
3
4SYNOPSIS
5 package Foo;
6 use Module::Pluggable::Ordered;
7
8 Foo->call_plugins("some_event", @stuff);
9
10 Meanwhile, in a nearby module...
11
12 package Foo::Plugin::One;
13 sub some_event_order { 99 } # I get called last of all
14 sub some_event { my ($self, @stuff) = @_; warn "Hello!" }
15
16 And in another:
17
18 package Foo::Plugin::Two;
19 sub some_event_order { 13 } # I get called relatively early
20 sub some_event { ... }
21
22DESCRIPTION
23 This module behaves exactly the same as "Module::Pluggable", supporting
24 all of its options, but also mixes in the "call_plugins" method to your
25 class. "call_plugins" acts a little like "Class::Trigger"; it takes the
26 name of a method, and some parameters. Let's say we call it like so:
27
28 __PACKAGE__->call_plugins("my_method", @something);
29
30 "call_plugins" looks at the plugin modules found using
31 "Module::Pluggable" for ones which provide "my_method_order". It sorts
32 the modules numerically based on the result of this method, and then
33 calls "$_->my_method(@something)" on them in order. This produces an
34 effect a little like the System V init process, where files can specify
35 where in the init sequence they want to be called.
36
37SEE ALSO
38 Module::Pluggable, Class::Trigger
39
40AUTHORS
41 Simon Cozens, <simon@cpan.org> (author emeritus)
42 Christopher Nehren, <apeiron@cpan.org> (current maintainer)
43
44COPYRIGHT AND LICENSE
45 Copyright 2004 by Simon Cozens
46 Copyright 2004 by Christopher Nehren (current copyright holder)
47
48 This library is free software; you can redistribute it and/or modify it
49 under the same terms as Perl itself.
50
51ACKNOWLEDGEMENTS
52 Thanks to Simon Cozens for originally writing this module.
53