The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Build Status Coverage Status

NAME

Otogiri::Plugin - make Otogiri to pluggable

SYNOPSIS

use Otogiri;
use Otogiri::Plugin;
my $db = Otogiri->new( connect_info => ["dbi:SQLite:dbname=$dbfile", '', ''] );
Otogiri->load_plugin('UsefulPlugin');
$db->useful_method; #derived from UsefulPlugin

DESCRIPTION

Otogiri::Plugin provides Teng-like plugin function to Otogiri.

METHODS

$class->load_plugin($plugin_name, $opt)

Load plugin to Otogiri or subclass. This method is exported to Otogiri or it's subclass(not to Otogiri::Plugin namespace). By default, plugins are loaded from Otorigi::Plugin::$plugin_name namespace. If '+' is specified before $plugin_name, plugins are loaded specified package name. for example,

Otogiri->load_plugin('UsefulPlugin');          # loads Otogiri::Plugin::UsefulPlugin
Otogiri->load_plugin('+Some::Useful::Plugin'); # loads Some::Useful::Plugin

You can use alias method name like this,

Otogiri->load_plugin('UsefulPlugin', { 
    alias => {
        very_useful_method_but_has_so_long_name => 'very_useful_method', 
    }
});

In this case, plugin provides very_useful_method_but_has_so_long_name, but you can access very_useful_method

LICENSE

Copyright (C) Takuya Tsuchida.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Takuya Tsuchida tsucchi@cpan.org