Created
September 18, 2017 03:35
-
-
Save anonymous/73417fc11d1e270189a0d24e8c64adeb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
use Bailador; | |
use HTTP::Server::Simple; | |
my $latest = 0; # latest post num | |
my @titles = []; # post titles | |
# scan for new posts | |
sub scan { | |
if !dir.contains('posts') { exit; say "Where's the 'posts' directory?";$ | |
$latest = Int(+dir 'posts'); | |
return if $latest == 0; | |
@titles = []; | |
loop (my $i = $latest; $i > 0; $i--) { | |
@titles[$latest - $i] = "posts/$i.html".IO.lines[0]; | |
} | |
} | |
scan(); | |
Supply.interval(360).tap: { scan(); } | |
get '/me' => sub { | |
template 'index.tm', @titles | |
} | |
get '/gnupg' => sub { | |
template 'gnupg.tm' | |
} | |
get / ^ '/blog/' (.+) $ / => sub ($post) { | |
template 'blog.tm',{ post => $post } | |
} | |
baile(8080); | |
** OUTPUT ** | |
Cannot resolve caller AUTOGEN(Bailador::App: Int); none of these signatures match: | |
(Bailador::App $: *%_) | |
(Bailador::App $: Str $command, *@args, *%_) | |
in sub baile at /home/benji/.perl6/install/share/perl6/site/sources/6F33C03589936F3E254B5C14BC95945C77196A75 (Bailador) line 157 | |
in block <unit> at app.pm6 line 33 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment