App-Greple-xlate
view release on metacpan or search on metacpan
like($out, qr/--anonymize='doc\.txt\.ANONYMIZE'/, 'FILE.ANONYMIZE wins');
unlike($out, qr/--anonymize=global\.json/, 'variable overridden');
};
subtest 'XOPT quotes values so custom regexes survive the shell' => sub {
my $gmake = find_gmake() or plan skip_all => 'GNU make not found';
my $mk = abs_path('share/XLATE.mk');
my $sub2 = "$dir/mk3"; mkdir $sub2;
mkdir "$sub2/bin" or die $!;
write_file("$sub2/bin/xlate", "#!/bin/sh\nprintf '%s\\n' \"\$@\"\n");
chmod 0755, "$sub2/bin/xlate";
write_file("$sub2/doc.txt", "hello\n");
# A realistic custom mark regex: unquoted parentheses in XLATE_MARK
# are a hard /bin/sh syntax error at recipe execution time (make -n
# never shows it, since -n never invokes the shell).
my $mark_re = '@@(?<category>[a-z]+):(?<text>[^@]+)@@';
my $target = 'doc.gpt5-JA.xtxt';
my $cmd = "cd '$sub2' && PATH='$sub2/bin:'\"\$PATH\" '$gmake' -f '$mk' " .
"XLATE_LANG=JA 'XLATE_MARK=$mark_re' '$target' 2>&1";
my $out = qx($cmd);
my $status = $? >> 8;
( run in 0.462 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )