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 pro‐
29 vides, instead of having to deal with the symbol table hackery involved
30 when writing a plugin module. Only three things must be remembered:
31
32 1 All methods which are to exported are given the "Plugged"
33 attribute. All other methods are not exported to the plugged-in
34 class.
35
36 2 Method calls which are to be sent to the plugged-in class are put
37 in the init() method. Examples of these are set_sql(), add_trig‐
38 ger() and so on.
39
40 3 The class parameter for the init() method and the "Plugged" methods
41 is the plugged-in class, not the plugin class.
42
44 So far this module only "sees" methods in the plugin module itself. If
45 there is a class between the base class and the plugin class in the
46 inheritance hierarchy, methods of this class will not be found. In
47 other words, inherited methods will not be found. If requested, I will
48 implement this behaviour.
49
51 It may be useful for plugin users to be able to choose only the plugin
52 methods they are interested in, if there are more than one. This is not
53 implemented yet.
54
56 · Class::DBI
57
59 Jean-Christophe Zeus, <mail@jczeus.com> with some help from Simon Coz‐
60 ens. Many thanks to Mark Addison for the idea with the init() method,
61 and many thanks to Steven Quinney for the idea with the subroutine
62 attributes.
63
65 Copyright (C) 2004 by Jean-Christophe Zeus
66
67 This library is free software; you can redistribute it and/or modify it
68 under the same terms as Perl itself.
69
70
71
72perl v5.8.8 2004-07-23 Plugin(3)