in reply to Re^2: Incomplete file write under Dancer2
in thread Incomplete file write under Dancer2

Possibly it is related to the lstat call on line 442.

What happens if you add a stat call with the same arguments immediately after it? This will reset the value in _

... $sub_nlink = (lstat ($no_chdir ? $dir_pref . $FN : $FN))[3]; my $debug = stat ($no_chdir ? $dir_pref . $FN : $FN))[3]; if (-d _) { ...