Skip to content

Commit

Permalink
updated POD to reflect the default option, and other pod cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
stevieb9 committed Mar 22, 2016
1 parent 807e851 commit 31a6a98
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
20 changes: 18 additions & 2 deletions README
Expand Up @@ -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){
Expand All @@ -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

Expand Down
19 changes: 17 additions & 2 deletions lib/Plugin/Simple.pm
Expand Up @@ -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){
Expand All @@ -208,11 +212,22 @@ It searches for modules in installed packages or non-installed files, and loads
them (without string C<eval>). You can optionally have us return only the
plugins that C<can()> perform a specific task.
=head1 LOAD OPTIONS
By default, we force C<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.
=head1 FUNCTIONS/METHODS
None. We simply install a C<plugin()> function within the namespace of the
package that C<use>d us. To specify a different sub name, use this module as
such: C<use Plugin::Simple sub_name =E<gt> 'name_of_sub';>.
package that C<use>d us.
=head1 AUTHOR
Expand Down

0 comments on commit 31a6a98

Please sign in to comment.