Skip Menu |

This queue is for tickets about the Archive-Extract CPAN distribution.

Report information
The Basics
Id: 40472
Status: resolved
Priority: 0/
Queue: Archive-Extract

People
Owner: Nobody in particular
Requestors: brian.d.foy [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] * localize Archive::Tar::WARN and give it the same value as Archive::Extract::WARN
Date: Tue, 28 Oct 2008 16:21:26 -0500
To: bug-archive-extract [...] rt.cpan.org
From: "brian d foy" <brian.d.foy [...] gmail.com>
You might want to handle this differently since I just kludge patched this. I ran into a problem with $Archive::Extract::WARN = 0 not squashing all of the warnings. When Archive::Tar loads, it sets its own $WARN to true so those warnings still come out. I want the Archive::Tar warnings setting to be the same as Archive::Extract's setting. I don't even want to know that extract() uses Archive::Tar. Additionally, no matter what Archive::Extract::extract does, I don't want it to change any value of $Archive::Tar::WARN that I set previously. --- lib/Archive/Extract.pm | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/Archive/Extract.pm b/lib/Archive/Extract.pm index 810d607..f123c03 100644 --- a/lib/Archive/Extract.pm +++ b/lib/Archive/Extract.pm @@ -692,7 +692,16 @@ sub _untar_bin { sub _untar_at { my $self = shift; - ### we definitely need A::T, so load that first + # Loading Archive::Tar is going to set it to 1, so make it local + # within this block, starting with its initial value. Whatever + # Achive::Tar does will be undone when we return. + # + # Also, later, set $Archive::Tar::WARN to $Archive::Extract::WARN + # so users don't have to even think about this variable. If they + # do, they still get their set value outside of this call. + local $Archive::Tar::WARN = $Archive::Tar::WARN; + + ### we definitely need Archive::Tar, so load that first { my $use_list = { 'Archive::Tar' => '0.0' }; unless( can_load( modules => $use_list ) ) { @@ -746,6 +755,10 @@ sub _untar_at { $fh_to_read = $bz; } + ### $Archive::Tar::WARN is 1 by default in Archive::Tar, but we've + ### localized $Archive::Tar::WARN already. + $Archive::Tar::WARN = $Archive::Extract::WARN; + my $tar = Archive::Tar->new(); ### only tell it it's compressed if it's a .tgz, as we give it a file @@ -764,7 +777,7 @@ sub _untar_at { *Archive::Tar::chown = sub {}; } - ### for version of archive::tar > 1.04 + ### for version of Archive::Tar > 1.04 local $Archive::Tar::CHOWN = 0; { local $^W; # quell 'splice() offset past end of array' warnings -- 1.5.4
On Tue Oct 28 17:21:44 2008, brian.d.foy@gmail.com wrote: Show quoted text
> You might want to handle this differently since I just kludge patched
this. Seems just fine to me; thanks, applied!