NAME

   Plugin::Simple - Load plugins from files or modules.

SYNOPSIS

       use Plugin::Simple;

       # load a plugin module from a file

       @plugins = plugins('/path/to/MyModule.pm');

       # load all modules under '__PACKAGE__::Plugin' namespace

       my @plugins = plugins();

       # load all plugins under a specific namespace

       @plugins = plugins('Any::Namespace');

       # load a plugin module from a file

       @plugins = plugins('/path/to/MyModule.pm');

       # load/return only the plugins that can perform specific functions

       @plugins = plugins(can => ['foo', 'bar]); # foo and bar

       # instead of importing 'plugins()', change the name:

       use Plugin::Simple sub_name => 'foo';
       @plugins = foo(...);

       # do something with the plugins

       for my $plugin (@plugins){
           $plugin->plugin_func(@args);
       }

       # works in OO modules too simply by using it

       my @plugins = $self->plugins();

DESCRIPTION

   There are many plugin modules available on the CPAN, but I wrote this
   one just for fun. It's very simple, extremely lightweight (core only),
   and is extremely minimalistic in what it does.

   It searches for modules in installed packages or non-installed files,
   and loads them (without string eval). You can optionally have us return
   only the plugins that can() perform a specific task.

FUNCTIONS/METHODS

   None. We simply install a plugin() function within the namespace of the
   package that used us. To specify a different sub name, use this module
   as such: use Plugin::Simple sub_name => 'name_of_sub';.

AUTHOR

   Steve Bertrand, <steveb at cpan.org>

CONTRIBUTING

   Any and all feedback and help is appreciated. A Pull Request is the
   preferred method of receiving changes
   (https://github.com/stevieb9/p5-plugin-simple), but regular patches
   through the bug tracker, or even just email discussions are welcomed.

BUGS

   https://github.com/stevieb9/p5-plugin-simple/issues

SUPPORT

   You can find documentation for this script and module with the perldoc
   command.

       perldoc Plugin::Simple;

SEE ALSO

   There are far too many plugin import modules on the CPAN to mention
   here.

LICENSE AND COPYRIGHT

   Copyright 2016 Steve Bertrand.

   This program is free software; you can redistribute it and/or modify it
   under the terms of either: the GNU General Public License as published
   by the Free Software Foundation; or the Artistic License.

   See http://dev.perl.org/licenses/ for more information.