Actually, You're not closing the file handle correctly.
Your $fh has no ->close method, it should be written as close $fh; instead;
As for the end of file, try running this before closing the file $tar->writeeof;
In reply to Re: Archive::Tar::Streamed Unexpected end-of-file
by ahmad
in thread Archive::Tar::Streamed Unexpected end-of-file
by DanEllison
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |