Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

class::dbi::plugin(3pm) [debian man page]

Plugin(3pm)						User Contributed Perl Documentation					       Plugin(3pm)

NAME
Class::DBI::Plugin - Abstract base class for Class::DBI plugins SYNOPSIS
use base 'Class::DBI::Plugin'; sub init { my $class = shift; $class->set_sql( statement_name => ... ); $class->add_trigger( ... ); $class->columns( TEMP => ... ); } sub method_name : Plugged { my $class = shift; $class->sql_statement_name( ... ); } sub this_method_is_not_exported {} DESCRIPTION
Class::DBI::Plugin is an abstract base class for Class::DBI plugins. Its purpose is to make writing plugins easier. Writers of plugins should be able to concentrate on the functionality their module provides, instead of having to deal with the symbol table hackery involved when writing a plugin module. Only three things must be remembered: 1. All methods which are to exported are given the "Plugged" attribute. All other methods are not exported to the plugged-in class. 2. Method calls which are to be sent to the plugged-in class are put in the init() method. Examples of these are set_sql(), add_trigger() and so on. 3. The class parameter for the init() method and the "Plugged" methods is the plugged-in class, not the plugin class. CAVEATS
So far this module only "sees" methods in the plugin module itself. If there is a class between the base class and the plugin class in the inheritance hierarchy, methods of this class will not be found. In other words, inherited methods will not be found. If requested, I will implement this behaviour. TODO
It may be useful for plugin users to be able to choose only the plugin methods they are interested in, if there are more than one. This is not implemented yet. SEE ALSO
o Class::DBI AUTHOR
Jean-Christophe Zeus, <mail@jczeus.com> with some help from Simon Cozens. Many thanks to Mark Addison for the idea with the init() method, and many thanks to Steven Quinney for the idea with the subroutine attributes. COPYRIGHT AND LICENSE
Copyright (C) 2004 by Jean-Christophe Zeus This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.0 2004-07-23 Plugin(3pm)

Check Out this Related Man Page

Class::Pluggable(3pm)					User Contributed Perl Documentation				     Class::Pluggable(3pm)

NAME
Class::Pluggable - Simple pluggable class. SYNOPSIS
use Class::Pluggable; use base qw(Class::Pluggable); # Some::Plugin::Module has sub routin called newAction add_plugin("Some::Plugin::Module"); newAction(); # Plugged action. DESCRIPTION
This class makes your class (sub class of Class::Pluggable) pluggable. In this documentatin, the word "pluggable" has two meanings. One is just simply adding new method to your pluggable classs from other plugin modules. So, after you plugged some modules to your class, you can use there method exactly same as your own object method. You can see this kind of plugin mechanism in CGI::Application and CGI::Application::Plugin::Session. There are one thing that Plugin developer have to know. The plugin module MUST have @EXPORT_AS_PLUGIN to use this pluggable mechanism. This works almost same as @EXPORT. But the methods in the @EXPORT_AS_PLUGIN wouldn't be exported to your package. But it would be exported to the subclass of Class::Pluggable (only when you call add_plugin()). And the another meaning of "pluggable" is so called hook-mechanism. For example, if you want to allow to other modules to do something before and/or after some action. You can do like this: $self->execute_plugin_method($_, "before_action") foreach $self->get_plugins(); ## do some your own action here. $self->execute_plugin_method($_, "after_action") foreach $self->get_plugins(); METHODS
Here are all methods of Class::Pluggable. add_plugin $object->add_plugin($pluginName) This will add new plugin to your class. What you added to here would be returned by get_plugins() method. get_plugins @plugins = $object->get_plugins(); It will return all of plugin names that are already added to YouClass. execute_plugin_method $result = $object->execute_plugin_method("SomePlugin", "someMethod"); This will execute the method someMethod of SomePlugin. execute_all_plugin_method $object->execute_all_plugin_method("someMethod"); This will execute the method someMethod of all plugin we have. This is almost same as following code. $self->execute_plugin_method($_, "someMethod") foreach $self->get_plugins(); The difference is executeAllPluginMethod can't return any values. But executePluginMethod can. add_hook $object->add_hook("pre-init", "pre_init"); This will add new hook to your class. Whenever run_hook("pre-init") has called, the method pre_init of all plugins which we have will be executed. run_hook $object->run_hook("pre-init"); This will execute the hook-method of all plugins which we have. remove_hook $object->remove_hook("pre-init"); This will delete the hook from YourClass. After calling this method, you cannot call run_hook("pre-init"). If you do, it will die imme- diately. SEE ALSO
... AUTHOR
Ken Takeshige, <ken.takeshige@gmail.com> COPYRIGHT AND LICENSE
Copyright (C) 2006 by Ken Takeshige This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available. perl v5.8.8 2006-06-30 Class::Pluggable(3pm)
Man Page