NAME

Nile::Dispatcher - Application action dispatcher.

SYNOPSIS

package Nile::Plugin::Home::Home;

use Nile::Base;

sub home  : GET Action {
	my ($self) = @_;
}

1;

DESCRIPTION

Nile::Dispatcher - Application action dispatcher.

dispatch()

# dispatch the default route or detect route from request
$self->dispatcher->dispatch;

# dispatch specific route and request method
$self->me->dispatcher->dispatch($route, $request_method);

action()

my ($plugin, $controller, $action) = $self->me->dispatcher->action($route);
#route /plugin/controller/action returns (Plugin, Controller, action)
#route /plugin/action returns (Plugin, Plugin, action)
#route /plugin returns (Plugin, Plugin, index)

Find the action plugin, controller and method name from the provided route.

route()

my $route = $self->me->dispatcher->route($route);

Detects the current request path if not provided from the request params named as 'action', 'route', or 'cmd' in the post or get methods:

# uri route
/blog/?action=register

# form route
<input type="hidden" name="action" value="register" />

If not found, it will try to detect the route from the request uri after the path part

# assuming application path is /blog, so /register will be the route
/blog/register

Bugs

This project is available on github at https://github.com/mewsoft/Nile.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Nile.

SOURCE

Source repository is at https://github.com/mewsoft/Nile.

AUTHOR

Ahmed Amin Elsheshtawy, احمد امين الششتاوى <mewsoft@cpan.org> Website: http://www.mewsoft.com

COPYRIGHT AND LICENSE

Copyright (C) 2014-2015 by Dr. Ahmed Amin Elsheshtawy احمد امين الششتاوى mewsoft@cpan.org, support@mewsoft.com, https://github.com/mewsoft/Nile, http://www.mewsoft.com

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