CLI-Dispatch

 view release on metacpan or  search on metacpan

lib/CLI/Dispatch/Help.pm  view on Meta::CPAN


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).

=head2 output

by default, takes a text, decode/encode it if necessary, prints the result to
stdout, and returns the text.



( run in 0.613 second using v1.01-cache-2.11-cpan-e9199f4ba4c )