On Fri, 2015-10-30 at 21:04 +0000, Carl Friedberg wrote:
> Craig,
> 
> Wow, thanks for your meticulous research. Great job!
> 
> Carl
> 
> Carl Friedberg
> friedb...@esb.com  (212) 798-0718
> www.esb.com
> The Elias Book of Baseball Records
> 2015 Edition
> 
> 
> -----Original Message-----
> From: Craig A. Berry [mailto:craigbe...@mac.com] 
> Sent: Friday, October 30, 2015 4:59 PM
> To: vmsperl (vmsperl@perl.org)
> Subject: Re: Excel::Writer on OpenVMS
> 
> 
> > On Oct 30, 2015, at 9:43 AM, Craig A. Berry <craigbe...@mac.com> wrote:
> > 
> > It still fails to clean up the temp directory and I think it’s that same 
> > [Content_Types].xml file that is causing the problem.  Don’t have a 
> > solution for that yet.
> 
> Now I do.  When the File::Temp destructor tries to clean up the temp 
> directory, it calls File::Path::rmtree, which navigates to each directory and 
> deletes each file in it before deleting the directory.  That fails because 
> [Content_Types].xml as a relative specification is ambiguous, so the delete 
> of that file fails and then the attempt to delete the directory containing it 
> fails.
> 
> Deleting [Content_Types].xml as part of an absolute path is fine, though, as 
> it’s not ambiguous when there are directory components present. We can help 
> things out by deleting the files we’ve created before the File::Temp 
> destructor ever attempts to go after them.
> 
> So along with DECC$FILENAME_UNIX_REPORT, the following gets us a working 
> Excel::Writer::XLSX on VMS:
> 
> $ gdiff -pu lib/Excel/Writer/XLSX/Workbook.pm;-0 
> lib/Excel/Writer/XLSX/Workbook.pm
> --- lib/Excel/Writer/XLSX/Workbook.pm;-0      2015-10-29 14:09:16 -0500
> +++ lib/Excel/Writer/XLSX/Workbook.pm 2015-10-30 13:07:34 -0500
> @@ -964,7 +964,7 @@ sub _store_workbook {
>      # with File::Find and pass each one to addFile().
>      my @xlsx_files;
> 
> -    my $wanted = sub { push @xlsx_files, $File::Find::name if -f };
> +    my $wanted = sub { push @xlsx_files, $File::Find::name unless -d };
> 
>      File::Find::find(
>          {
> @@ -1010,6 +1010,7 @@ sub _store_workbook {
>              print { $self->{_filehandle} } $buffer;
>          }
>      }
> +    for my $f ( @xlsx_files ) { 1 while unlink $f; }
>  }
> 
> 
> [end]
> 
> ________________________________________
> Craig A. Berry
> mailto:craigbe...@mac.com
> 
> "... getting out of a sonnet is much more
>  difficult than getting in."
>                  Brad Leithauser
> 

What version of Workbook.pm do you have?  Line 964 in mine is not:

sub _store_workbook {



Reply via email to