| 1 | package Text::Livedoor::Wiki::Plugin; | ||||||||||
| 2 | |||||||||||
| 3 | 13 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 13 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 13 | ▶ | use Module::Pluggable::Object; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 13 | ▶ | sub inline_plugins { | ||||||||
|
Subroutine
inline_plugins: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 8 | 13 | my $self = shift; | |||||||||
| 9 | 13 | my $opts = shift; | |||||||||
| 10 | 13 | $self->_load_plugins( 'Inline' , $opts ); | |||||||||
| 11 | } | ||||||||||
| 12 | 15 | ▶ | sub function_plugins { | ||||||||
|
Subroutine
function_plugins: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 13 | 15 | my $self = shift; | |||||||||
| 14 | 15 | my $opts = shift; | |||||||||
| 15 | 15 | $self->_load_plugins( 'Function' , $opts ); | |||||||||
| 16 | } | ||||||||||
| 17 | 7 | ▶ | sub block_plugins { | ||||||||
|
Subroutine
block_plugins: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 18 | 7 | my $self = shift; | |||||||||
| 19 | 7 | my $opts = shift; | |||||||||
| 20 | 7 | $self->_load_plugins( 'Block' , $opts ); | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | #{{{ private | ||||||||||
| 24 | 35 | ▶ | sub _load_plugins { | ||||||||
|
Subroutine
_load_plugins: called CC=4 SCAR=13.9
| |||||||||||
| 25 | 35 | my $self = shift; | |||||||||
| 26 | 35 | my $type = shift; | |||||||||
| 27 | 35 | my $opts = shift; | |||||||||
| 28 | 35 | my @search_path = ( 'Text::Livedoor::Wiki::Plugin::' . $type ); | |||||||||
| 29 | # XXX | ||||||||||
| 30 | 35 | my @except = ( 'Text::Livedoor::Wiki::Plugin::Block::ListBase' ); | |||||||||
| 31 | |||||||||||
| 32 | 35 | ▶ | if( $opts->{search_path} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 1 | push @search_path , @{$opts->{search_path}}; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 35 | ▶ | if( $opts->{except} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 1 | push @except , @{$opts->{except}}; | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 35 | my $finder | |||||||||
| 41 | = Module::Pluggable::Object->new( search_path => \@search_path , except => \@except ); | ||||||||||
| 42 | 35 | my @plugins = $finder->plugins; | |||||||||
| 43 | |||||||||||
| 44 | 35 | ▶ | if( $opts->{addition} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | 3 | push @plugins , @{ $opts->{addition} } ; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 35 | return \@plugins; | |||||||||
| 49 | } | ||||||||||
| 50 | #}}} | ||||||||||
| 51 | |||||||||||
| 52 | 13 | 1; | |||||||||
| 53 | |||||||||||
| 54 | =head1 NAME | ||||||||||
| 55 | |||||||||||
| 56 | Text::Livedoor::Wiki::Plugin - Getting Plugin List | ||||||||||
| 57 | |||||||||||
| 58 | =head1 SYNOPSIS | ||||||||||
| 59 | |||||||||||
| 60 | my $block_plugins = Text::Livedoor::Wiki::Plugin->block_plugins; | ||||||||||
| 61 | my $inline_plugins = Text::Livedoor::Wiki::Plugin->inline_plugins; | ||||||||||
| 62 | my $function_plugins= Text::Livedoor::Wiki::Plugin->function_plugins; | ||||||||||
| 63 | |||||||||||
| 64 | my $custom_block_plugins | ||||||||||
| 65 | = Text::Livedoor::Wiki::Plugin->block_plugins({ | ||||||||||
| 66 | except => ['My::Plugin::Hoge'], search_path => [ 'My::Plugin' ] , addition => [ 'My::Plugin::Hage' ] | ||||||||||
| 67 | }) | ||||||||||
| 68 | ; | ||||||||||
| 69 | |||||||||||
| 70 | =head1 DESCRIPTION | ||||||||||
| 71 | |||||||||||
| 72 | this module only return plugin list . | ||||||||||
| 73 | |||||||||||
| 74 | =head1 FUNCTIONS | ||||||||||
| 75 | |||||||||||
| 76 | =head2 block_plugins | ||||||||||
| 77 | |||||||||||
| 78 | return block plugin list | ||||||||||
| 79 | |||||||||||
| 80 | =head2 inline_plugins | ||||||||||
| 81 | |||||||||||
| 82 | return inline plugin list | ||||||||||
| 83 | |||||||||||
| 84 | =head2 function_plugins | ||||||||||
| 85 | |||||||||||
| 86 | return inline function list | ||||||||||
| 87 | |||||||||||
| 88 | =head1 ARGS | ||||||||||
| 89 | |||||||||||
| 90 | =head2 search_path | ||||||||||
| 91 | |||||||||||
| 92 | SEE L<Module::Pluggable::Object> search_path option. | ||||||||||
| 93 | |||||||||||
| 94 | =head2 except | ||||||||||
| 95 | |||||||||||
| 96 | SEE L<Module::Pluggable::Object> except option. | ||||||||||
| 97 | |||||||||||
| 98 | =head2 addition | ||||||||||
| 99 | |||||||||||
| 100 | set list of plugin you want to set | ||||||||||
| 101 | |||||||||||
| 102 | =head1 SEE ALSO | ||||||||||
| 103 | |||||||||||
| 104 | L<Module::Pluggable::Object> | ||||||||||
| 105 | |||||||||||
| 106 | =head1 AUTHOR | ||||||||||
| 107 | |||||||||||
| 108 | polocky | ||||||||||
| 109 | |||||||||||
| 110 | =cut | ||||||||||