<&| SELF:wrapper, title => "odin.gg URL Shortener" &>

odin.gg URL Shortener

">
% if (defined $tag) {

Shortened to: "><% "$Odin::SHORTURL/$tag" %> % } %# <%init> my $tag = $m->dhandler_arg; if (length $tag) { my $url = Odin::get_shorturl $tag; if ($q) { $m->comp(".query", url => $url); } else { $m->redirect($url, 301); } return; } elsif (defined $u) { $tag = Odin::new_shorturl $u; } else { Odin::path_info($r) =~ m:/$: or $m->redirect("$Odin::SHORTURL/", 301); $tag = undef; } %# <%args> $q => undef $u => undef %# <%def .query>\ % $r->content_type("text/plain; charset=utf8"); <% $url %> <%args> $url %# <%def .notfound>\ <&| SELF:error, title => "not found", status => 404 &>\ tag ‘<% $tag |h %>’ not found <%args> $tag %# <%def .badurl>\ <&| SELF:error, title => "invalid url", status => 404 &>\ ‘<% $u |h %>’ is not a valid URL <%args> $u %# <%once> use utf8; use Odin;