Skip to content

Instantly share code, notes, and snippets.

@perigrin
Created July 28, 2009 19:56
Show Gist options
  • Select an option

  • Save perigrin/157633 to your computer and use it in GitHub Desktop.

Select an option

Save perigrin/157633 to your computer and use it in GitHub Desktop.
dispatcher => (
'/' => 'index',
'/login' => resource(
representations => {
'text/html' => sub {'<h1>Comming Soon</h1>'}
},
);
);
resource index( Request $r) with(
Authentication('OpenID'),
Storage('JSON'),
Template('TT2'),
) {
has valid_users => (
isa => 'HashRef',
lazy_build => 1,
traits => ['Hash'],
handles => {
exists => 'is_authorized',
}
);
sub _build_valid_users { { 'chris.prather.org' => 1 } }
method content { { title => 'hello world' } }
template q[<h1>[% this.title %]</h2>];
representations {
'text/html' => 'render_template',
'text/json' => 'freeze', # provided by Storage
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment