Skip Menu |

This queue is for tickets about the Compress-Zlib CPAN distribution.

Report information
The Basics
Id: 1952
Status: resolved
Priority: 0/
Queue: Compress-Zlib

People
Owner: pmqs [...] cpan.org
Requestors: chris [...] clotho.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.19
Fixed in: 2.000_01



Subject: gzopen doesn't work on IO::String filehandles
Running Compress-Zlib-1.19 via IO::Zlib-1.02 under perl 5.8.0-darwin (OSX). This code snippet fails with the error message: gzopen: file parameter is not a filehandle or filename at show.pl line 6 ------------ show.pl ----------- use IO::String; use Compress::Zlib; my $buf = "testing"; my $fh = IO::String->new($buf); my $gz_fh = gzopen($fh, "r"); ------------ show.pl ----------- The problem is that gzopen needs filehandles to be GLOBs but IO::String objects are not GLOBs at their core. Additionally, IO::Strings return undef from fileno(), so this is clearly a deeper problem... Perhaps gzopen could test against (can("fileno") && defined fileno()) instead of the GLOB test. I realize that I could use Compress::Zlib::memGzip to do what the example above is trying to do, but I have a more complex case where I create the IO handle at a high level and pass it back to a much deeper routine that wants to add a gzip layer. My app needs to be 5.6.0-compatible, so PerlIO::gzip is not an option here, I think.
From: "Paul Marquess" <Paul.Marquess [...] btinternet.com>
To: <bug-Compress-Zlib [...] rt.cpan.org>
Subject: RE: [cpan #1952] gzopen doesn't work on IO::String filehandles
Date: Sat, 18 Jan 2003 00:18:47 -0000
RT-Send-Cc:
The problem is as deep as you suspect. The call to the Perl gzopen just acts as an interface to the zlib C functions gzopen and gzdopen. When you pass the perl gzopen a filehandle, I arrange to call gzdopen with the C fileno associated with the open file. Given that gzdopen can only cope with file descriptors, there is no way it can cope with an IO::String. Paul Show quoted text
> -----Original Message----- > From: Guest via RT [mailto:bug-Compress-Zlib@rt.cpan.org] > Sent: 17 January 2003 23:41 > To: AdminCc of cpan Ticket #1952 : > Subject: [cpan #1952] gzopen doesn't work on IO::String filehandles > > > > This message about Compress-Zlib was sent to you by guest <> via > rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=1952 > > > Running Compress-Zlib-1.19 via IO::Zlib-1.02 under perl > 5.8.0-darwin (OSX). > > This code snippet fails with the error message: > gzopen: file parameter is not a filehandle or filename at > show.pl line 6 > > ------------ show.pl ----------- > use IO::String; > use Compress::Zlib; > > my $buf = "testing"; > my $fh = IO::String->new($buf); > my $gz_fh = gzopen($fh, "r"); > ------------ show.pl ----------- > > The problem is that gzopen needs filehandles to be GLOBs but > IO::String objects are not GLOBs at their core. Additionally, > IO::Strings return undef from fileno(), so this is clearly a > deeper problem... Perhaps gzopen could test against > (can("fileno") && defined fileno()) instead of the GLOB test. > > I realize that I could use Compress::Zlib::memGzip to do what the > example above is trying to do, but I have a more complex case > where I create the IO handle at a high level and pass it back to > a much deeper routine that wants to add a gzip layer. My app > needs to be 5.6.0-compatible, so PerlIO::gzip is not an option > here, I think.