Re: Excel::Writer on OpenVMS

Brian Schenkenberger <[email protected]> Mon, 02 Nov 2015 12:09:08 -0500
Newsgroups gmane.comp.lang.perl.ports.vms
Organization TMESIS
Message-ID <1446484148.7630.2.camel@Envy17>
On Fri, 2015-10-30 at 21:04 +0000, Carl Friedberg wrote:
> Craig,
>=20
> Wow, thanks for your meticulous research. Great job!
>=20
> Carl
>=20
> Carl Friedberg
> [email protected]  (212) 798-0718
> www.esb.com
> The Elias Book of Baseball Records
> 2015 Edition
>=20
>=20
> -----Original Message-----
> From: Craig A. Berry [mailto:[email protected]]=20
> Sent: Friday, October 30, 2015 4:59 PM
> To: vmsperl ([email protected])
> Subject: Re: Excel::Writer on OpenVMS
>=20
>=20
> > 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.
>=20
> Now I do.  When the File::Temp destructor tries to clean up the temp dire=
ctory, it calls File::Path::rmtree, which navigates to each directory and d=
eletes 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.
>=20
> 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=99ve created before =
the File::Temp destructor ever attempts to go after them.
>=20
> So along with DECC$FILENAME_UNIX_REPORT, the following gets us a working =
Excel::Writer::XLSX on VMS:
>=20
> $ gdiff -pu lib/Excel/Writer/XLSX/Workbook.pm;-0 lib/Excel/Writer/XLSX/Wo=
rkbook.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;
>=20
> -    my $wanted =3D sub { push @xlsx_files, $File::Find::name if -f };
> +    my $wanted =3D sub { push @xlsx_files, $File::Find::name unless -d }=
;
>=20
>      File::Find::find(
>          {
> @@ -1010,6 +1010,7 @@ sub _store_workbook {
>              print { $self->{_filehandle} } $buffer;
>          }
>      }
> +    for my $f ( @xlsx_files ) { 1 while unlink $f; }
>  }
>=20
>=20
> [end]
>=20
> ________________________________________
> Craig A. Berry
> mailto:[email protected]
>=20
> "... getting out of a sonnet is much more
>  difficult than getting in."
>                  Brad Leithauser
>=20

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

sub _store_workbook {