There's simple (if not trivial) solution with a splat, FWIW.  
Probably there's a better way to specify the path. 

I was distracted looking for something more magical.

Thanks,

--

use Text::Markdown 'markdown';
use File::Slurper 'read_text';

get '**' => sub {
    my ($route) = splat; 
    say "route: @$route";
    my @route = @$route;
    my $file = pop @route;
    $file .= '.md';
    my $path = path(dirname($0), '..', 'lib', 'md', @route , $file);
    pass if not -r $path;
    say "path: $path";
    my $md = read_text($path);
    say "markdown: $md";
    my $content = markdown($md);
    say "content: $content";
    template 'index' => { title => 'mimizufarm', 'content' => $content }
};


-- 
Joel Roth
_______________________________________________
dancer-users mailing list
dancer-users@lists.preshweb.co.uk
https://lists.preshweb.co.uk/mailman/listinfo/dancer-users

Reply via email to