NAME

Mojolicious::Plugin::AutoRoutePm - Mojolicious plugin to create routes by *.pm modules which are a controller

github workflow tests Top language: github last commit

VERSION

version 0.22

SYNOPSIS

use Mojolicious::Lite;
plugin 'AutoRoutePm', {
    route   => [ app->routes ],
    top_dir => 'site',
};

DESCRIPTION

This module recursive passes through template_base_dir to find perl modules (*.pm) that are a subclass of Mojolicious::Controller and adds routes for them.

USAGE

For module X::Y::Z it adds the decamelize version

x/y/z
x/y/z/index
x/y/z/index/*query

all redirect to action route inside module.

If Z is default_index it adds also

x/y
x/y/*query

The last structure is useful for routing seach. But be careful to correct relative urls of other items in html page.

This can be done in many ways. One is, as an example, to add to the layout a base_url like this

% my $base_url = url_for(undef, {query => undef}); $base_url =~ s|/$||;
<base href="<%= $base_url %>" />

register

plugin->register($app);

Register plugin in Mojolicious application.

BUGS/CONTRIBUTING

Please report any bugs through the web interface at https://github.com/EmilianoBruni/mojo-websocket-pubsub/issues If you want to contribute changes or otherwise involve yourself in development, feel free to fork the Git repository from https://github.com/EmilianoBruni/mojo-websocket-pubsub/.

SUPPORT

You can find this documentation with the perldoc command too.

perldoc Mojo::WebSocket::PubSub

SEE ALSO

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

AUTHOR

Emiliano Bruni <info@ebruni.it>

COPYRIGHT AND LICENSE

This software is copyright (c) 2021 by Emiliano Bruni.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.