package SugarTrail; use Dancer ':syntax'; use SugarTrail::Repo; use helper; use URL::Encode qw/ url_decode /; our $VERSION = '0.1'; my $repo_root = '/srv/strail/strepo'; my $repo_vcs = 'git'; my $repo = SugarTrail::Repo->new( root => $repo_root, vcs=> $repo_vcs ); get qr{(/[^\?]*)} => sub { my ($stm) = split '\?', $ENV{REQUEST_URI}, 2; $stm = url_decode($stm); my $m = $repo->load_stm( stm => $stm . '.stm' ); unless ($m) { return template 'not_found'; } my $params = params(); my $s = $m->generate_slave($params); &helper::dmup(params=>$params); return '
' . $s->source . '
'; }; true;