CLI::Dispatch::Help - show help
to list available commands: > perl your_script.pl to show help of a specific command: > perl your_script.pl help command you may want to encode/decode the text: > perl your_script.pl command --help --from=utf-8 --to=shift_jis
This command is used to show help, and expects the first section of the pod of each command to be a NAME (or equivalent) section with a class name and brief description of the class/command, separated by a hyphen and arbitrary numbers of white spaces (like this pod).
If you distribute your script, you may want to make a subclass of this command just to provide more user-friendly document (content-wise and language-wise).
shows a list of available commands (with brief description if any), or help (pod) of a specific command.
by default, encode/decode options are available to change encoding.
by default, this command looks for commands just under the namespace you specified in the script/dispatcher. However, you may want it to look into other directories to show something like tutorials. For example, if you make a subclass like this:
package MyScript::Help; use strict; use base qw( CLI::Dispatcher::Help ); sub extra_namespaces { qw( MyScript::Cookbook ) } 1;
then, when you run the script like this, MyScript/Cookbook/Install.pod (or .pm) will be shown:
> perl myscript.pl help install
You may even make it language-conscious:
package MyScript::Help; use strict; use base qw( CLI::Dispatcher::Help ); sub options {qw( lang=s )} sub extra_namespaces { my $self = shift; my $lang = uc( $self->option('lang') || 'EN' ); return ( 'MyScript::Cookbook::'.$lang, 'MyScript::Cookbook::EN', # in case of $lang is wrong ); 1;
This can be used to provide more user-friendly documents (without overriding commands themselves).
by default, takes a text, decode/encode it if necessary, prints the result to stdout, and returns the text.
takes a command and looks for the actual pm/pod file to read its pod, and returns the pod (without the first section to hide the class name and brief description).
takes a pod, removes the first ("NAME") section, and returns the pod. You may also want to hide other sections like "AUTHOR" and "COPYRIGHT" for end users.
returns a concatenated text of a list of the available commands with brief description (if any).
takes a name of a command, converts it if necessary (decamelize by default), and returns the result.
takes a pod, extract the first ("NAME") section (actually the first line of the first section), and returns it. Override this if you don't want to cut longer (multi-lined) description.
Kenichi Ishigaki, <ishigaki@cpan.org>
Copyright (C) 2008 by Kenichi Ishigaki.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install CLI::Dispatch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CLI::Dispatch
CPAN shell
perl -MCPAN -e shell install CLI::Dispatch
For more information on module installation, please visit the detailed CPAN module installation guide.