Skip to content

Instantly share code, notes, and snippets.

@AlexDaniel
Forked from scmorrison/mustache-hyper.pl6
Last active August 20, 2017 16:43
Show Gist options
  • Save AlexDaniel/3396e315ce0d21c084da0406e9abfd4c to your computer and use it in GitHub Desktop.
Save AlexDaniel/3396e315ce0d21c084da0406e9abfd4c to your computer and use it in GitHub Desktop.
Perl 6 - Template::Mustache.render dies with hyper
#!/usr/bin/env perl6
use lib ‘data/all-modules/softmoth/p6-Template-Mustache’;
use v6;
#use v6.d.PREVIEW;
use Template::Mustache;
my $html = q:to/EOF/;
<html>
{{> head }}
<body>
<div>
{{ render_me }}
</div>
</body>
</html>
EOF
my %partials = head => q:to/EOF/;
<head>
<title>{{ title }}</title>
</head>
EOF
my @pages;
# working: [1..1000].map
# working: for [1..1000]
my @pages = [1..1000].hyper.map: {
my $render = Template::Mustache.render: $html, %( render_me => "render-{$_}", title => "title-{$_}" ), from => [%partials];
say $render;
$render;
};
# variation
#[1..1000].hyper.map: {
# my $render = Template::Mustache.render: $html, %( render_me => "render-{$_}", title => "title-{$_}" ), from => [%partials];
# push @pages, $render;
# say $render;
#};
say @pages.elems;
# rakudo p6v status
# 2017.07-58-gd4d77b66c v6.c failure
# 2017.07-58-gd4d77b66c v6.d.PREVIEW failure
# 2017.07 v6.c failure
# 2017.07 v6.d.PREVIEW failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment