NAME

Mojolicious::Plugin::DOCRenderer - Doc Renderer Plugin

SYNOPSIS

# Mojolicious::Lite
plugin 'DOCRenderer';
plugin DOCRenderer => {module => 'MyApp'};
plugin DOCRenderer => {name => 'foo'};
plugin DOCRenderer => {url => '/mydoc'};
plugin DOCRenderer => {preprocess => 'epl'};

# Mojolicious
$self->plugin('DOCRenderer');
$self->plugin(DOCRenderer => {module => 'MyApp'});
$self->plugin(DOCRenderer => {name => 'foo'});
$self->plugin(DOCRenderer => {url => '/mydoc'});
$self->plugin(DOCRenderer => {preprocess => 'epl'});

#############################
# Mojolicious::Lite example #
#############################
use Mojolicious::Lite;
use File::Basename;

plugin 'DOCRenderer' => {
    # use this script base name as a default module to show for "/doc"
    module => fileparse( __FILE__, qr/\.pl/ )
};

app->start;

__END__

=head1 NAME

MyApp - My Mojolicious::Lite Application

=head1 DESCRIPTION

This documentation will be available online, for example from L<http://localhost:3000/doc>.

=cut

#######################
# Mojolicious example #
#######################
package MyApp;
use Mojo::Base 'Mojolicious';

sub development_mode {
  # Enable browsing of "/doc" only in development mode
  shift->plugin( 'DOCRenderer' );
}

sub startup {
  my $self = shift;
  # some code
}

__END__

=head1 NAME

MyApp - My Mojolicious Application

=head1 DESCRIPTION

This documentation will be available online, for example from L<http://localhost:3000/doc>.

=cut

DESCRIPTION

Mojolicious::Plugin::DOCRenderer generates on-the-fly and browses online POD documentation directly from your Mojolicious application source codes and makes it available under /doc (customizable).

The plugin expects that you use POD to document your codes of course.

The plugin is simple modification of Mojolicious::Plugin::PODRenderer.

OPTIONS

module

# Mojolicious::Lite
plugin DOCRenderer => {module => 'MyApp'};

Name of the module to initially display. Default is $ENV{MOJO_APP}. Mojolicious::Lite application may have undefined $ENV{MOJO_APP}; in such case you should set module, see Mojolicious::Lite example.

name

# Mojolicious::Lite
plugin DOCRenderer => {name => 'foo'};

Handler name.

no_doc

# Mojolicious::Lite
plugin DOCRenderer => {no_doc => 1};

Disable doc browser. Note that this option is EXPERIMENTAL and might change without warning!

preprocess

# Mojolicious::Lite
plugin DOCRenderer => {preprocess => 'epl'};

Handler name of preprocessor.

url

# Mojolicious::Lite
plugin DOCRenderer => {url => '/mydoc'};

URL from which the documentation of your project is available. Default is /doc.

METHODS

Mojolicious::Plugin::DOCRenderer inherits all methods from Mojolicious::Plugin and implements the following new ones.

register

$plugin->register;

Register renderer in Mojolicious application.

SEE ALSO

Mojolicious::Plugin::PODRenderer, Mojolicious, Mojolicious::Guides, http://mojolicio.us.