List Info

Thread: IO::Zlib ignores $/




IO::Zlib ignores $/
user name
2007-09-20 15:57:08
I'm sure id did behave somewhere not too long ago:

nb09:/pro/3gl/CPAN/perl-current 125 > zcat xx.gz
line 1
line 2
  ne 3
line 4

line 6
line 7
nb09:/pro/3gl/CPAN/perl-current 126 > cat xx.pl
#!/pro/bin/perl

use strict;
use warnings;

use IO::Zlib;

my $fh = IO::Zlib->new ("xx.gz",
"rb") or die "Cannot open xx.gz: $!n";

# Print the header
{   local $/ = "nn";
    print scalar <$fh>;
    }

print "==============n";

# Print the rest
{   local $/;
    print <$fh>;
    }
nb09:/pro/3gl/CPAN/perl-current 127 > ./perl -Ilib xx.pl
line 1
==============
line 2
  ne 3
line 4

line 6
line 7
nb09:/pro/3gl/CPAN/perl-current 128 >

-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/
)
using & porting perl 5.6.2, 5.8.x, 5.9.x   on HP-UX
10.20, 11.00, 11.11,
& 11.23, SuSE 10.0 & 10.2, AIX 4.3 & 5.2, and
Cygwin. http://qa.perl.org
http://mirrors.de
velooper.com/hpux/            http://www.test-smoke.org
                        http
://www.goldmark.org/jeff/stupid-disclaimers/

Re: IO::Zlib ignores $/
user name
2007-09-21 01:23:09
On Thu, 20 Sep 2007 20:57:08 +0000, "H.Merijn
Brand" <h.m.brandxs4all.nl>
wrote:

> I'm sure id did behave somewhere not too long ago:
> 
> nb09:/pro/3gl/CPAN/perl-current 125 > zcat xx.gz
> line 1
> line 2
>   ne 3
> line 4
> 
> line 6
> line 7
> nb09:/pro/3gl/CPAN/perl-current 126 > cat xx.pl
> #!/pro/bin/perl
> 
> use strict;
> use warnings;
> 
> use IO::Zlib;
> 
> my $fh = IO::Zlib->new ("xx.gz",
"rb") or die "Cannot open xx.gz: $!n";
> 
> # Print the header
> {   local $/ = "nn";
>     print scalar <$fh>;
>     }
> 
> print "==============n";
> 
> # Print the rest
> {   local $/;
>     print <$fh>;
>     }
> nb09:/pro/3gl/CPAN/perl-current 127 >

Work for Andreas' magic search tools?

nb09:/pro/3gl/CPAN/test 152 > perl5.8.7 xx.pl
Using perl 5.008007 with IO::Zlib 1.04
line 1
line 2
  ne 3
line 4

==============
line 6
line 7
nb09:/pro/3gl/CPAN/test 153 > perl5.9.5 xx.pl
Using perl 5.009005 with IO::Zlib 1.06_01
line 1
line 2
  ne 3
line 4

==============
line 6
line 7
nb09:/pro/3gl/CPAN/test 154 >

That last one was with 31644 if -V did the right thing
As you can see, the above two work fine

-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/
)
using & porting perl 5.6.2, 5.8.x, 5.9.x   on HP-UX
10.20, 11.00, 11.11,
& 11.23, SuSE 10.0 & 10.2, AIX 4.3 & 5.2, and
Cygwin. http://qa.perl.org
http://mirrors.de
velooper.com/hpux/            http://www.test-smoke.org
                        http
://www.goldmark.org/jeff/stupid-disclaimers/

Re: IO::Zlib ignores $/
user name
2007-09-21 02:18:47
On Fri, 21 Sep 2007 06:23:09 +0000, "H.Merijn
Brand" <h.m.brandxs4all.nl>
wrote:
> 
> Work for Andreas' magic search tools?

perl-5.8.7-24641 with IO::Zlib 1.04    was still OK
perl-5.8.8-27040 with IO::Zlib 1.04    was NOT   OK
perl-5.9.5-28213 with IO::Zlib 1.06_01 was still OK
perl-5.8.8-28213 with IO::Zlib 1.07    was NOT   OK

I have fixed my script with a workaound:

    (my $mlm = join "", <$fh>) =~
s{^.*?nn}{}s;
    eval $mlm;

-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/
)
using & porting perl 5.6.2, 5.8.x, 5.9.x   on HP-UX
10.20, 11.00, 11.11,
& 11.23, SuSE 10.0 & 10.2, AIX 4.3 & 5.2, and
Cygwin. http://qa.perl.org
http://mirrors.de
velooper.com/hpux/            http://www.test-smoke.org
                        http
://www.goldmark.org/jeff/stupid-disclaimers/

RE: IO::Zlib ignores $/
user name
2007-09-21 03:49:19
From: H.Merijn Brand [mailto:h.m.brandxs4all.nl]
 
> On Thu, 20 Sep 2007 20:57:08 +0000, "H.Merijn
Brand" <h.m.brandxs4all.nl>
> wrote:
> 
> > I'm sure id did behave somewhere not too long
ago:
> >
> > nb09:/pro/3gl/CPAN/perl-current 125 > zcat
xx.gz
> > line 1
> > line 2
> >   ne 3
> > line 4
> >
> > line 6
> > line 7
> > nb09:/pro/3gl/CPAN/perl-current 126 > cat
xx.pl
> > #!/pro/bin/perl
> >
> > use strict;
> > use warnings;
> >
> > use IO::Zlib;
> >
> > my $fh = IO::Zlib->new ("xx.gz",
"rb") or die "Cannot open xx.gz: $!n";
> >
> > # Print the header
> > {   local $/ = "nn";
> >     print scalar <$fh>;
> >     }
> >
> > print "==============n";
> >
> > # Print the rest
> > {   local $/;
> >     print <$fh>;
> >     }
> > nb09:/pro/3gl/CPAN/perl-current 127 >
> 
> Work for Andreas' magic search tools?
> 
> nb09:/pro/3gl/CPAN/test 152 > perl5.8.7 xx.pl
> Using perl 5.008007 with IO::Zlib 1.04
> line 1
> line 2
>   ne 3
> line 4
> 
> ==============
> line 6
> line 7
> nb09:/pro/3gl/CPAN/test 153 > perl5.9.5 xx.pl
> Using perl 5.009005 with IO::Zlib 1.06_01
> line 1
> line 2
>   ne 3
> line 4
> 
> ==============
> line 6
> line 7
> nb09:/pro/3gl/CPAN/test 154 >
> 
> That last one was with 31644 if -V did the right thing
> As you can see, the above two work fine

There is a dependency chain at work here -- IO-Zlib relies
on Compress::Zlib
to handle $/ and there was a change in Compress::Zlib in
this area recently.

This is the relevant entry from the Compress::Zlib 2.006
Changes 

  * lib/Compress/Zlib.pm
    Make gzreadline not support $/, just like in
Compress::Zlib 1.x
    Folk who want $/ with readline support can get it in
    IO::Uncompress::Gunzip.
    [rt.cpan.org #28663] and Debian bug #435656 
    http://bugs.debian.org/
435656
  

Paul


Re: IO::Zlib ignores $/
user name
2007-09-21 04:42:34
On Fri, 21 Sep 2007 09:49:19 +0100, "Paul
Marquess"
<paul_marquessyahoo.co.uk> wrote:

> > That last one was with 31644 if -V did the right
thing
> > As you can see, the above two work fine  
> 
> There is a dependency chain at work here -- IO-Zlib
relies on Compress::Zlib
> to handle $/ and there was a change in Compress::Zlib
in this area recently.
> 
> This is the relevant entry from the Compress::Zlib
2.006 Changes 
> 
>   * lib/Compress/Zlib.pm
>     Make gzreadline not support $/, just like in
Compress::Zlib 1.x
>     Folk who want $/ with readline support can get it
in
>     IO::Uncompress::Gunzip.
>     [rt.cpan.org #28663] and Debian bug #435656 
>     http://bugs.debian.org/
435656

Thanks for the heads-up, but this for sure breaks IO::Zlib,
and - as an
end-user - I don't want to know what is happening below
ground-level, I
just want my scripts to do what they have always done. 
Should IO::Zlib
be `fixed' to do the right thing?

-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/
)
using & porting perl 5.6.2, 5.8.x, 5.9.x   on HP-UX
10.20, 11.00, 11.11,
& 11.23, SuSE 10.0 & 10.2, AIX 4.3 & 5.2, and
Cygwin. http://qa.perl.org
http://mirrors.de
velooper.com/hpux/            http://www.test-smoke.org
                        http
://www.goldmark.org/jeff/stupid-disclaimers/

RE: IO::Zlib ignores $/
user name
2007-09-21 05:28:19
From: H.Merijn Brand [mailto:h.m.brandxs4all.nl]
 
> On Fri, 21 Sep 2007 09:49:19 +0100, "Paul
Marquess"
> <paul_marquessyahoo.co.uk> wrote:
> 
> > > That last one was with 31644 if -V did the
right thing
> > > As you can see, the above two work fine
> >
> > There is a dependency chain at work here --
IO-Zlib relies on
> Compress::Zlib
> > to handle $/ and there was a change in
Compress::Zlib in this area
> recently.
> >
> > This is the relevant entry from the Compress::Zlib
2.006 Changes
> >
> >   * lib/Compress/Zlib.pm
> >     Make gzreadline not support $/, just like in
Compress::Zlib 1.x
> >     Folk who want $/ with readline support can get
it in
> >     IO::Uncompress::Gunzip.
> >     [rt.cpan.org #28663] and Debian bug #435656
> >     http://bugs.debian.org/
435656
> 
> Thanks for the heads-up, but this for sure breaks
IO::Zlib, and - as an
> end-user - I don't want to know what is happening below
ground-level, I
> just want my scripts to do what they have always done. 


The scripts must be relatively new then - the behaviour you
are seeing was
only added (by accident) in Compress::Zlib 2.x

> Should IO::Zlib be `fixed' to do the right thing?

Good question, but the change to Compress::Zlib 2.006 does
make the
behaviour of IO::Zlib consistent. Remember that IO::Zlib
will fallback to
using the commandline gzip program when Compress::Zlib isn't
available. 

If IO::Zlib used Compress::Zlib 2.001 through to 2.005, then
$/ support was
present when it was running with Compress::Zlib and absent
when it was using
gzip directly. 

Paul


Re: IO::Zlib ignores $/
user name
2007-09-21 05:36:43
On Fri, 21 Sep 2007 11:28:19 +0100, "Paul
Marquess"
<paul_marquessyahoo.co.uk> wrote:

> From: H.Merijn Brand [mailto:h.m.brandxs4all.nl]
>  
> > On Fri, 21 Sep 2007 09:49:19 +0100, "Paul
Marquess"
> > <paul_marquessyahoo.co.uk> wrote:
> > 
> > > > That last one was with 31644 if -V did
the right thing
> > > > As you can see, the above two work fine
> > >
> > > There is a dependency chain at work here --
IO-Zlib relies on
> > > Compress::Zlib to handle $/ and there was a
change in
> > > Compress::Zlib in this area recently.
> > >
> > > This is the relevant entry from the
Compress::Zlib 2.006 Changes
> > >
> > >   * lib/Compress/Zlib.pm
> > >     Make gzreadline not support $/, just like
in Compress::Zlib 1.x
> > >     Folk who want $/ with readline support
can get it in
> > >     IO::Uncompress::Gunzip.
> > >     [rt.cpan.org #28663] and Debian bug
#435656
> > >     http://bugs.debian.org/
435656
> > 
> > Thanks for the heads-up, but this for sure breaks
IO::Zlib, and - as an
> > end-user - I don't want to know what is happening
below ground-level, I
> > just want my scripts to do what they have always
done.  
> 
> The scripts must be relatively new then - the behaviour
you are seeing was
> only added (by accident) in Compress::Zlib 2.x

Relative is such a relative concept 

First backup found:
2007-03-05 15:12:39 pc09:/pro/3gl/CPAN/modlist

> > Should IO::Zlib be `fixed' to do the right thing?
> 
> Good question, but the change to Compress::Zlib 2.006
does make the
> behaviour of IO::Zlib consistent. Remember that
IO::Zlib will fallback to
> using the commandline gzip program when Compress::Zlib
isn't available. 
> 
> If IO::Zlib used Compress::Zlib 2.001 through to 2.005,
then $/ support was
> present when it was running with Compress::Zlib and
absent when it was using
> gzip directly.

If I had be using gzip myself, I would have opened it
through a pipe,
and then $/ would have worked. I'm using IO::Zlib so I gain
speed (at
least I hope I do).

-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/
)
using & porting perl 5.6.2, 5.8.x, 5.9.x   on HP-UX
10.20, 11.00, 11.11,
& 11.23, SuSE 10.0 & 10.2, AIX 4.3 & 5.2, and
Cygwin. http://qa.perl.org
http://mirrors.de
velooper.com/hpux/            http://www.test-smoke.org
                        http
://www.goldmark.org/jeff/stupid-disclaimers/

RE: IO::Zlib ignores $/
user name
2007-09-21 05:48:04
From: H.Merijn Brand [mailto:h.m.brandxs4all.nl]
 
> On Fri, 21 Sep 2007 11:28:19 +0100, "Paul
Marquess"
> <paul_marquessyahoo.co.uk> wrote:
> 
> > From: H.Merijn Brand [mailto:h.m.brandxs4all.nl]
> >
> > > On Fri, 21 Sep 2007 09:49:19 +0100,
"Paul Marquess"
> > > <paul_marquessyahoo.co.uk> wrote:
...
> 
> > > Should IO::Zlib be `fixed' to do the right
thing?
> >
> > Good question, but the change to Compress::Zlib
2.006 does make the
> > behaviour of IO::Zlib consistent. Remember that
IO::Zlib will fallback
> to
> > using the commandline gzip program when
Compress::Zlib isn't available.
> >
> > If IO::Zlib used Compress::Zlib 2.001 through to
2.005, then $/ support
> was
> > present when it was running with Compress::Zlib
and absent when it was
> using
> > gzip directly.
> 
> If I had be using gzip myself, I would have opened it
through a pipe,
> and then $/ would have worked. I'm using IO::Zlib so I
gain speed (at
> least I hope I do).

I obviously haven't had enough caffeine today.

IO::Zlib uses a pipe to read from the external gzip, so it
*does* have $/
support. Duh!

Paul


[1-8]

about | contact  Other archives ( Real Estate discussion Medical topics )