From 31a6a98a509b0df5160c217510a374e31d74dc56 Mon Sep 17 00:00:00 2001 From: Steve Bertrand Date: Tue, 22 Mar 2016 08:28:08 -0600 Subject: [PATCH] updated POD to reflect the default option, and other pod cleanup --- README | 20 ++++++++++++++++++-- lib/Plugin/Simple.pm | 19 +++++++++++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/README b/README index 77a50c2..727d792 100644 --- a/README +++ b/README @@ -27,6 +27,10 @@ SYNOPSIS use Plugin::Simple sub_name => 'foo'; @plugins = foo(...); + # set a default fallback plugin if searching turns up nothing + + use Plugin::Simple default => 'My::Module::Plugin::DefaultPlugin' + # do something with the plugins for my $plugin (@plugins){ @@ -47,11 +51,23 @@ DESCRIPTION and loads them (without string eval). You can optionally have us return only the plugins that can() perform a specific task. +LOAD OPTIONS + + By default, we force plugins() into your namespace. To change this + name: + + use Plugin::Simple sub_name => 'other_name'; + + If searching fails, you can ensure a default known plugin gets loaded: + + use Plugin::Simple default => 'My::Plugin'; + + To use both options, simply separate them with a comma. + 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';. + package that used us. AUTHOR diff --git a/lib/Plugin/Simple.pm b/lib/Plugin/Simple.pm index 58019d0..e9eee17 100644 --- a/lib/Plugin/Simple.pm +++ b/lib/Plugin/Simple.pm @@ -188,6 +188,10 @@ Plugin::Simple - Load plugins from files or modules. use Plugin::Simple sub_name => 'foo'; @plugins = foo(...); + # set a default fallback plugin if searching turns up nothing + + use Plugin::Simple default => 'My::Module::Plugin::DefaultPlugin' + # do something with the plugins for my $plugin (@plugins){ @@ -208,11 +212,22 @@ It searches for modules in installed packages or non-installed files, and loads them (without string C). You can optionally have us return only the plugins that C perform a specific task. +=head1 LOAD OPTIONS + +By default, we force C into your namespace. To change this name: + + use Plugin::Simple sub_name => 'other_name'; + +If searching fails, you can ensure a default known plugin gets loaded: + + use Plugin::Simple default => 'My::Plugin'; + +To use both options, simply separate them with a comma. + =head1 FUNCTIONS/METHODS None. We simply install a C function within the namespace of the -package that Cd us. To specify a different sub name, use this module as -such: C 'name_of_sub';>. +package that Cd us. =head1 AUTHOR