Leo Charre > CGI-Application-Plugin-HelpMan-1.09 > CGI::Application::Plugin::HelpMan

Download:
CGI-Application-Plugin-HelpMan-1.09.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 1.09   Source  

NAME ^

CGI::Application::Plugin::HelpMan - man lookup and help doc for your cgi app

DESCRIPTION ^

I believe that your cgi application should not be an API, it should be a web interface to an API. Just like a script should be a command line interface to an API. Thus documentation in your cgi app should be for the user, not a programmer.

If you are of the sentiment your pod documentation in your cgi app should be the docs used for the end user, then this module is for you.

TEMPORARY DIRECTORY ^

Pod::Html needs a temp dir that it can read/write to for tmp files. By default it is /tmp If you want otherwise:

   my $app = new CGIAPPusingthis(
      PARAMS => { abs_tmp => '/tmp' }
   );

METHODS ^

None are exported by default, you can import all with the export tag ':all'. You can do

   use CGI::Application::Plugin::HelpMan ':all';

hm_abs_tmp()

Pod::Html needs a temp dir to write to. See "TEMPORARY DIRECTORY"

hm_doc_body()

returns body of the html that Pod::Html spat out.

hm_doc_title()

returns title of the html that Pod::Html spat out. could be undef

hm_found_term_abs()

returns boolean

hm_found_term_doc()

hm_found_term_query()

hm_set_term()

force term

hm_term_get()

returns term string

PRIVATE METHODS ^

None are exported by default, you can import all public and private methods with the export tag ':all'.

_doc_html()

returns what Pod::Html spat out.

_term_abs_path()

returns the absolute path the search resolved to for the code (pod) file

SUBROUTINES ^

The following subs are not OO. They can be imported into your code explicitly or with the tag ':ALL'.

__abs_path_doc_to_html()

argument is abs path to file tries to get html doc with Pod::Html

__find_abs()

argument is a string tries to resolve to disk via File::Which and Pod::Simple::Search

__string_looks_like_command()

argument is string, returns boolean - if it looks like a unix command

__term_to_command()

argument is string, tries to see if it looks like a unix command, returns command string or undef

__term_to_namespace()

argument is string tries to clean up into a perl namespace

CREATING A HELP RUNMODE ^

Imagine you have your cgi app.. "My::App1".

Inside App1.pm, make sure your pod doccumentation is present.

Then your app needs a help runmode..

   sub rm_help {
      my $self = shift;
   
      my $return = sprintf "<h1>%s</h1> %s", $self->hm_help_title, $self->hm_help_body;   
      return $return;      
   }  

That's it.

For a more interesting example, complete with lookup, etc.. see CGI::Application::HelpMan.

If that fails try

      sub rm_help {
      my $self = shift;
      $self->hm_set_term('Your::Package');
   
      my $return = sprintf "<h1>%s</h1> %s", $self->hm_help_title, $self->hm_help_body;   
      return $return;      
   }  

AUTHOR ^

Leo Charre leocharre at cpan dot org

SEE ALSO ^

CGI::Application LEOCHARRE::DEBUG