Subject: | Filed to generate proper code segment |
When the packed module does not end with "\n", it generates a segment with mis-placed here-
doc marker at the end.
File::Path::Tiny module is an instance of such module.
The solution in the attached path is to add that \n when it's missing.
Subject: | fatpacker-missing-newline.diff |
diff --git a/lib/App/FatPacker.pm b/lib/App/FatPacker.pm
index 2f39841..4399341 100644
--- a/lib/App/FatPacker.pm
+++ b/lib/App/FatPacker.pm
@@ -182,7 +182,7 @@ sub script_command_file {
my @segments = map {
(my $stub = $_) =~ s/\.pm$//;
my $name = uc join '_', split '/', $stub;
- my $data = $files{$_}; $data =~ s/^/ /mg;
+ my $data = $files{$_}; $data =~ s/^/ /mg; $data =~ s/(?<!\n)\z/\n/;
'$fatpacked{'.perlstring($_).qq!} = <<'${name}';\n!
.qq!${data}${name}\n!;
} sort keys %files;