Skip to content

Instantly share code, notes, and snippets.

@perlpilot
Created July 7, 2010 04:26
Show Gist options
  • Save perlpilot/466305 to your computer and use it in GitHub Desktop.
Save perlpilot/466305 to your computer and use it in GitHub Desktop.
package Catalyst::View::MaybeMobileTT;
use Moose;
extends 'Catalyst::View::TT';
override 'process' => sub {
my ($self,$c) = @_;
my $template = $c->stash->{template}
|| $c->action . $self->config->{TEMPLATE_EXTENSION};
if (is_mobile($c)) {
$template .= '-mobile';
}
$c->stash->{template} = $template;
super();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment