App::LDAP::Role::Command - make a class act as a command
package App::LDAP::Command::YourCommand; use Moose; with 'App::LDAP::Role::Command'; has foo => ( is => "rw", isa => "Str", ); around prepare => sub { my $orig = shift; my $self = shift; # hook some actions $self->$orig(@_); }; sub run { my $self = shift; # do something } package main; App::LDAP::Command::YourCommand->new_with_options()->prepare()->new();
This role should be included in any module aimed at being a handler in App::LDAP. It mixs the MooseX::Getopt and App::LDAP::Role and defines the wrappers to Namespace::Dispatch. That is, a command can declare the acceptable options as describing in MooseX::Getopt, invoking helpers from App::LDAP::Role, and dispatching like 'use Namespace::Dispatch'.
the instance method invoked before running.
$class->new_with_options()->prepare()->run()
this method is designed to be hooked with 'around' in Moose and just returns the instance itself here.
the wrapper of Namespace::Dispatch::dispatch()
$class->dispatch(@consequences)
the wrapper of Namespace::Dispatch::has_leaf()
$class->has_leaf('name');
the wrapper of Namespace::Dispatch::leaves()
$submodules = $class->leaves();
given a plain text password, the helper returns an encrypted one.
$hashed = encrypt($plain);
read and confirm the new password from terminal. die if failing to confirm.
$plain = new_password();
To install App::LDAP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::LDAP
CPAN shell
perl -MCPAN -e shell install App::LDAP
For more information on module installation, please visit the detailed CPAN module installation guide.