1Plugin(3) User Contributed Perl Documentation Plugin(3)
2
3
4
6 Class::DBI::Plugin - Abstract base class for Class::DBI plugins
7
9 use base 'Class::DBI::Plugin';
10
11 sub init {
12 my $class = shift;
13 $class->set_sql( statement_name => ... );
14 $class->add_trigger( ... );
15 $class->columns( TEMP => ... );
16 }
17
18 sub method_name : Plugged {
19 my $class = shift;
20 $class->sql_statement_name( ... );
21 }
22
23 sub this_method_is_not_exported {}
24
26 Class::DBI::Plugin is an abstract base class for Class::DBI plugins.
27 Its purpose is to make writing plugins easier. Writers of plugins
28 should be able to concentrate on the functionality their module
29 provides, instead of having to deal with the symbol table hackery
30 involved when writing a plugin module. Only three things must be
31 remembered:
32
33 1. All methods which are to exported are given the "Plugged"
34 attribute. All other methods are not exported to the plugged-in
35 class.
36
37 2. Method calls which are to be sent to the plugged-in class are put
38 in the init() method. Examples of these are set_sql(),
39 add_trigger() and so on.
40
41 3. The class parameter for the init() method and the "Plugged" methods
42 is the plugged-in class, not the plugin class.
43
45 So far this module only "sees" methods in the plugin module itself. If
46 there is a class between the base class and the plugin class in the
47 inheritance hierarchy, methods of this class will not be found. In
48 other words, inherited methods will not be found. If requested, I will
49 implement this behaviour.
50
52 It may be useful for plugin users to be able to choose only the plugin
53 methods they are interested in, if there are more than one. This is not
54 implemented yet.
55
57 ยท Class::DBI
58
60 Jean-Christophe Zeus, <mail@jczeus.com> with some help from Simon
61 Cozens. Many thanks to Mark Addison for the idea with the init()
62 method, and many thanks to Steven Quinney for the idea with the
63 subroutine attributes.
64
66 Copyright (C) 2004 by Jean-Christophe Zeus
67
68 This library is free software; you can redistribute it and/or modify it
69 under the same terms as Perl itself.
70
71
72
73perl v5.30.1 2020-01-29 Plugin(3)