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

Getting closer...

After sprinkling File::Find with print statements I find that in the latest version of File::Find does this at line 444:

                    if (-d _) {

This is the code that decides whether or not the thing it has found is a directory, and whether to recurse into it. Under Dancer this test fails for the subdirectories and it never recurses into them. But what is _ meant to be? Is that a thing I don't know about? If I change it to $_ it does recurse into the directory, and I end up with a valid XLSX file. There are lots of uses of an underscore on its own across this module.

Replies are listed 'Best First'.
Re^3: Incomplete file write under Dancer2
by swl (Prior) on Jul 25, 2024 at 23:04 UTC

    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 _) { ...
Re^3: Incomplete file write under Dancer2
by NERDVANA (Priest) on Jul 25, 2024 at 19:14 UTC
    I forget where this is described in the docs, but it refers to the most recently called 'stat' results. It's handy, but a bit arcane.