| 1 |
Class/DBI/Plugin version 0.01 |
| 2 |
============================= |
| 3 |
|
| 4 |
INSTALLATION |
| 5 |
|
| 6 |
To install this module type the following: |
| 7 |
|
| 8 |
perl Makefile.PL |
| 9 |
make |
| 10 |
make test |
| 11 |
make install |
| 12 |
|
| 13 |
Note that "make test" only runs a "live" example if both DBD::SQLite and |
| 14 |
SQL::Abstract are installed. |
| 15 |
|
| 16 |
DEPENDENCIES |
| 17 |
|
| 18 |
This module requires these other modules and libraries: |
| 19 |
|
| 20 |
Class::DBI |
| 21 |
|
| 22 |
SYNOPSIS |
| 23 |
use base 'Class::DBI::Plugin'; |
| 24 |
|
| 25 |
sub init { |
| 26 |
my $class = shift; |
| 27 |
$class->set_sql( statement_name => ... ); |
| 28 |
$class->add_trigger( ... ); |
| 29 |
$class->columns( TEMP => ... ); |
| 30 |
} |
| 31 |
|
| 32 |
sub method_name : Plugged { |
| 33 |
my $class = shift; |
| 34 |
$class->sql_statement_name( ... ); |
| 35 |
} |
| 36 |
|
| 37 |
sub this_method_is_not_exported {} |
| 38 |
|
| 39 |
DESCRIPTION |
| 40 |
Class::DBI::Plugin is an abstract base class for Class::DBI plugins. |
| 41 |
Its purpose is to make writing plugins easier. Writers of plugins |
| 42 |
should be able to concentrate on the functionality their module pro- |
| 43 |
vides, instead of having to deal with the symbol table hackery involved |
| 44 |
when writing a plugin module. Only three things must be remembered: |
| 45 |
|
| 46 |
1 All methods which are to exported are given the "Plugged" |
| 47 |
attribute. All other methods are not exported to the plugged-in |
| 48 |
class. |
| 49 |
|
| 50 |
2 Method calls which are to be sent to the plugged-in class are put |
| 51 |
in the init() method. Examples of these are set_sql(), add_trig- |
| 52 |
ger() and so on. |
| 53 |
|
| 54 |
3 The class parameter for the init() method and the "Plugged" methods |
| 55 |
is the plugged-in class, not the plugin class. |
| 56 |
|
| 57 |
CAVEATS |
| 58 |
So far this module only "sees" methods in the plugin module itself. If |
| 59 |
there is a class between the base class and the plugin class in the |
| 60 |
inheritance hierarchy, methods of this class will not be found. In |
| 61 |
other words, inherited methods will not be found. If requested, I will |
| 62 |
implement this behaviour. |
| 63 |
|
| 64 |
TODO |
| 65 |
It may be useful for plugin users to be able to choose only the plugin |
| 66 |
methods they are interested in, if there are more than one. This is not |
| 67 |
implemented yet. |
| 68 |
|
| 69 |
SEE ALSO |
| 70 |
o Class::DBI |
| 71 |
|
| 72 |
AUTHOR |
| 73 |
Jean-Christophe Zeus, <[email protected]> with some help from Simon Coz- |
| 74 |
ens. Many thanks to Mark Addison for the idea with the init() method, |
| 75 |
and many thanks to Steven Quinney for the idea with the subroutine |
| 76 |
attributes. |
| 77 |
|
| 78 |
COPYRIGHT AND LICENCE |
| 79 |
|
| 80 |
Copyright (C) 2004 Jean-Christophe Zeus |
| 81 |
|
| 82 |
This library is free software; you can redistribute it and/or modify |
| 83 |
it under the same terms as Perl itself. |
| 84 |
|