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';

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 startup {
  my $self = shift;

  # Enable browsing of "/doc" only in development mode
  $self->plugin( 'DOCRenderer' ) if $self->mode eq 'development';

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

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

my $route = $plugin->register(Mojolicious->new);
my $route = $plugin->register(Mojolicious->new, {name => 'foo'});

Register renderer in Mojolicious application.

SEE ALSO

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