Question

The NextRelease plugin for Dist::Zilla looks for {{$NEXT}} in the Changes file to put the release datetime information. However, I can't get this to be generated using my profile.ini. Here's what I have:

[GenerateFile / Generate-Changes ]
filename    = Changes
is_template = 1
content = Revision history for {{$dist->name}}
content =
;todo: how can we get this to print correctly with a template?
content = {{$NEXT}}
content =   initial release

{{$dist->name}} is correctly replaced with my distribution name, but {{$NEXT}} is, as-is, replaced with nothing (since it's not escaped and there is no $NEXT variable in). I've tried different combinations of slashes to escape the braces, but it either results in nothing or an error during generation with dzil new. How can I properly escape this string so that after dzil processes it with Text::Template it outputs {{$NEXT}}?

Was it helpful?

Solution

In the content, {{$NEXT}} is being interpreted as a template block and, as you say, wants to fill itself in as the contents of the missing $NEXT.

Instead, try:

content = {{'{{$NEXT}}'}}

Example program:

use 5.14.0;
use Text::Template 'fill_in_string';
my $result = fill_in_string(
  q<{{'{{$NEXT}}'}}>,
  DELIMITERS => [ '{{', '}}' ],
  BROKEN => sub { die },
);

say $result;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top