DBD::Sys::Plugin - embed own tables to DBD::Sys
This package is not intended to be used directly.
DBD::Sys is developed to use a unique, well known interface (SQL) to access data from underlying system which is available in tabular context (or easily could transformed into).
The major goal of DBD::Sys is the ability to have an interface to collect relevant data to operate a system - regardless the individual type. Therefore it uses plugins to provide the accessible tables and can be extended by adding plugins.
Each plugin must be named DBD::Sys::Plugin::Plugin-Name. This package can provide an external callable method named get_supported_tables which must return a hash containing the provided tables as key and the classes which implement the tables as associated value, e.g.:
DBD::Sys::Plugin::
get_supported_tables
package DBD::Sys::Plugin::Foo; use base qw(DBD::Sys::Plugin); sub get_supported_tables() { ( mytable => 'DBD::Sys::Plugin::Foo::MyTable'; ) }
If the table is located in additional module, it must be required either by the plugin package on loading or at least when it's returned by get_supported_tables.
If this method is not provided, the namespace below the plugin name will be scanned for tables using Module::Pluggable::Object:
sub DBD::Sys::Plugin::get_supported_tables { my $proto = blessed($_[0]) || $_[0]; my $finder = Module::Pluggable::Object->new( require => 1, search_path => [$proto], inner => 0, ); my @tableClasses = $finder->plugins(); ... }
It's strongly recommended to derive the table classes from DBD::Sys::Table, but it's required that it is a SQL::Eval::Table and provides the get_col_names and collect_data methods:
get_col_names
collect_data
package DBD::Sys::Plugin::Foo::MyTable; use base qw(DBD::Sys::Table); sub get_col_names() { qw(col1 col2 col3) } sub collect_data() { # ... return \@data; }
This method is using Module::Pluggable::Object to find all tables in the namespace of the class derived from DBD::Sys::Plugin. It's called (once at initialization) in package context and returns a hash with the supported tables as key and the according classes as value.
DBD::Sys::Plugin
A plugin what knows it's tables might override this method and return a static hash.
This method returns the default priority of a plugin (and table): 1000. See "new" in DBD::Sys::CompositeTable for more information about priorities of plugin and table classes.
Jens Rehsack CPAN ID: REHSACK rehsack@cpan.org http://search.cpan.org/~rehsack/
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
Free support can be requested via regular CPAN bug-tracking system at http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBD-Sys. There is no guaranteed reaction time or solution time, but it's always tried to give accept or reject a reported ticket within a week. It depends on business load. That doesn't mean that ticket via rt aren't handles as soon as possible, that means that soon depends on how much I have to do.
Business and commercial support should be acquired from the authors via preferred freelancer agencies.
To install DBD::Sys, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBD::Sys
CPAN shell
perl -MCPAN -e shell install DBD::Sys
For more information on module installation, please visit the detailed CPAN module installation guide.