Groups | Search | Server Info | Login | Register


Groups > perl.vmsperl > #7

RE: Excel::Writer on OpenVMS

Newsgroups perl.vmsperl
Subject RE: Excel::Writer on OpenVMS
Date 2015-10-30 21:04 +0000
Message-ID <ee99785a84c84cb3b9f4f2e63956ad65@Exchange1.esb.com> (permalink)
References (1 earlier) <615DF848-CE0D-4DC8-9CE2-3C10A54E0659@me.com> <7593FF06-3BAB-4184-9DFC-487A4DF0C5D2@me.com> <A1EDCF34-CAAC-4244-AB34-4223419568D6@me.com> <CB1321DD-E778-4F46-989B-A3ACAA5B7D86@mac.com> <46C31830-14FD-44E7-BC8C-F963885D8FF3@mac.com>
From friedberg@exs.esb.com (Carl Friedberg)

Show all headers | View raw


Craig,

Wow, thanks for your meticulous research. Great job!

Carl

Carl Friedberg
friedberg@esb.com  (212) 798-0718
www.esb.com
The Elias Book of Baseball Records
2015 Edition


-----Original Message-----
From: Craig A. Berry [mailto:craigberry@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 <craigberry@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:craigberry@mac.com

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser

Back to perl.vmsperl | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Excel::Writer on OpenVMS system@TMESIS.COM ("Brian Schenkenberger, VAXman-") - 2015-10-29 14:53 -0400
  Re: Excel::Writer on OpenVMS craigberry@me.com ("Craig A. Berry") - 2015-10-29 18:44 -0500
    Re: Excel::Writer on OpenVMS craigberry@mac.com ("Craig A. Berry") - 2015-10-30 09:43 -0500
      Re: Excel::Writer on OpenVMS craigberry@mac.com ("Craig A. Berry") - 2015-10-30 15:59 -0500
        RE: Excel::Writer on OpenVMS friedberg@exs.esb.com (Carl Friedberg) - 2015-10-30 21:04 +0000
          Re: Excel::Writer on OpenVMS VAXman@tmesis.com (Brian Schenkenberger) - 2015-11-02 12:09 -0500
  Re: Excel::Writer on OpenVMS craigberry@me.com ("Craig A. Berry") - 2015-10-29 14:58 -0500
  Re: Excel::Writer on OpenVMS craigberry@me.com ("Craig A. Berry") - 2015-10-29 14:40 -0500

csiph-web