| 1 | package App::LDAP::Role::Stem; | ||
| 2 | |||
| 3 | 4 | ▶ | use Modern::Perl; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 4 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 4 | with qw( App::LDAP::Role ); | |
| 8 | |||
| 9 | 0 | ▶ | around run => sub { |
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||
| 10 | 0 | my $orig = shift; | |
| 11 | 0 | my $self = shift; | |
| 12 | |||
| 13 | 0 | $self->$orig(@_); | |
| 14 | |||
| 15 | 0 | my $handler = $self->current_handler; | |
| 16 | |||
| 17 | 0 | say "usage: ldap$handler [subhandler]\n"; | |
| 18 | |||
| 19 | 0 | say "Available subhandlers are:"; | |
| 20 | |||
| 21 | 0 | my $leaves = ref($self)->leaves(); | |
| 22 | |||
| 23 | 0 | for (@$leaves) { | |
| 24 | 0 | printf(" %-11s", $_); | |
| 25 | # show annotation of the module here; | ||
| 26 | 0 | say ""; | |
| 27 | } | ||
| 28 | 4 | }; | |
| 29 | |||
| 30 | 0 | ▶ | sub current_handler { |
|
Subroutine
current_handler: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 31 | 0 | my ($self, ) = @_; | |
| 32 | |||
| 33 | 0 | my $command = lc(ref($self)); | |
| 34 | |||
| 35 | 0 | $command =~ s{app::ldap::command}{}; | |
| 36 | 0 | $command =~ s{::}{ }g; | |
| 37 | 0 | return $command; | |
| 38 | } | ||
| 39 | |||
| 40 | 4 | ▶ | no Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 41 | |||
| 42 | 4 | 1; | |
| 43 | |||
| 44 | =pod | ||
| 45 | |||
| 46 | =head1 NAME | ||
| 47 | |||
| 48 | App::LDAP::Role::Stem - A stem command shows its submodules | ||
| 49 | |||
| 50 | =head1 SYNOPSIS | ||
| 51 | |||
| 52 | package App::LDAP::Command::AStemCommand; | ||
| 53 | use Moose; | ||
| 54 | with qw( App::LDAP::Role::Command | ||
| 55 | App::LDAP::Role::Stem ); | ||
| 56 | |||
| 57 | sub run { | ||
| 58 | |||
| 59 | } | ||
| 60 | |||
| 61 | =cut | ||