Re: Excel::Writer on OpenVMS
[email protected] ("Craig A. Berry") Fri, 30 Oct 2015 15:59:23 -0500
| Newsgroups | perl.vmsperl |
|---|---|
| Message-ID | <[email protected]> |
> On Oct 30, 2015, at 9:43 AM, Craig A. Berry <[email protected]> = wrote: >=20 > It still fails to clean up the temp directory and I think it=E2=80=99s = that same [Content_Types].xml file that is causing the problem. Don=E2=80= =99t 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=E2=80=99s not ambiguous when there are directory = components present. We can help things out by deleting the files we=E2=80=99= 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 =3D sub { push @xlsx_files, $File::Find::name if -f }; + my $wanted =3D 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:[email protected] "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser