Skip to content

Instantly share code, notes, and snippets.

@mfontani
Created December 3, 2012 16:03
Show Gist options
  • Save mfontani/4195954 to your computer and use it in GitHub Desktop.
Save mfontani/4195954 to your computer and use it in GitHub Desktop.
Weird mark_raw problem with Xslate + wonky workaround
#!/usr/bin/env perl
use strict;
use warnings;
use Text::Xslate qw<mark_raw>;
use 5.010_000;
my $x = Text::Xslate->new(
function => {
p => sub {
return mark_raw( "L(@_)" );
}
},
);
# Works:
say $x->render_string('<: p("<a>") :>');
say $x->render_string('<: p("<a>" ~ "foo" ~ "</a>") :>');
# NO WORKY!
say $x->render_string('<: p("<a>" ~ p("foo") ~ "</a>") :>');
# KINDA FIX:
say $x->render_string('<: p( mark_raw("<a>") ~ p("foo") ~ mark_raw("</a>") ) :>');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment