Skip to content

Instantly share code, notes, and snippets.

@hisaichi5518
Created December 12, 2012 11:01
Show Gist options
  • Select an option

  • Save hisaichi5518/4266950 to your computer and use it in GitHub Desktop.

Select an option

Save hisaichi5518/4266950 to your computer and use it in GitHub Desktop.
chankoっぽいの考えたけどきつかった。
# in templates/root/index.tx
# active_ifが真でなければ無視
# 真なら include yaminabe/name/templates/root/index.test.tx
$c.yaminabe.invoke('name', 'tag');
# in yaminabe/name/templates/root/index.tag.tx
<p><a href="<: uri_for('/user/like') :>">like</a></p>
package Yaminabe::App::Name;
use strict;
use warnings;
sub active_if {
my ($self, $c) = @_;
$c->user && $c->user->is_admin;
}
package Yaminabe::App::Name::Web::Dispatcher;
use strict;
use warnings;
get '/user/like' => sub { ... };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment