Mojolicious::Plugin::Mobi - Mojolicious Plugin
# Mojolicious $self->plugin('Mobi'); $self->routes->route("/")->over(mobile=>1)->to("Mobile#index"); # or $self->render(text=>"You are mobile.") if $self->is_mobile; # Mojolicious::Lite - not tested this way plugin 'Mobi'; get '/' => sub { if (is_mobile()) { redirect_to("http://m.example.com"); } } # or get '/' => (mobile=>1) => sub { my $self = shift; $self->render(text=>"This is a mobile version of this site."); };
Mojolicious::Plugin::Mobi is a Mojolicious plugin. This module provides a helper method is_mobile and route condition to be more easy to use in your dispatcher.
Mojolicious::Plugin::Mobi inherits all methods from Mojolicious::Plugin and implements the following new ones.
register
$plugin->register;
Register plugin in Mojolicious application.
Mojolicious, Mojolicious::Guides, http://mojolicio.us.
To install Mojolicious::Plugin::Mobi, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::Mobi
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::Mobi
For more information on module installation, please visit the detailed CPAN module installation guide.