NAME
Mojolicious::Plugin::Mobi - Mojolicious Plugin
SYNOPSIS
# Mojolicious
# Register plugin Mobi and its helper to your application
$self->plugin('Mobi');
# One way of how to use it
$self->routes->route("/")->requires(mobile=>1)->to("Mobile#index");
# or another
$self->render(text=>"You are mobile.") if $self->is_mobile;
# Mojolicious::Lite
# Register plugin Mobi and its helper to your application
plugin 'Mobi';
# Use the helper anywhere within your app
get '/' => sub {
if (is_mobile()) {
redirect_to("http://m.example.com");
}
}
# or hook it up in the route as a requirement
get '/' => (mobile => 1) => sub {
my $self = shift;
$self->render(text => "This is a mobile version of this site.");
};
DESCRIPTION
Mojolicious::Plugin::Mobi is a Mojolicious plugin. This module provides a helper method is_mobile and route condition so it is easier to use in a dispatcher.
METHODS
Mojolicious::Plugin::Mobi inherits all methods from Mojolicious::Plugin and implements the following new ones.
register
$plugin->register;
Register plugin in Mojolicious application.
SEE ALSO
Mojolicious, Mojolicious::Guides, http://mojolicio.us.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 47:
Non-ASCII character seen before =encoding in '# Register'. Assuming UTF-8