Skip Menu |

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

Report information
The Basics
Id: 6527
Status: resolved
Priority: 0/
Queue: Archive-Tar

People
Owner: Nobody in particular
Requestors: radek [...] karnet.pl
Cc:
AdminCc:

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



Subject: list_archive() calls $obj->new(); this is not supported
I have already reported this bug via mail to kane at cpan.org; no response since Mon Apr 26 2004. The list_archive method calls new() this way: sub list_archive { my $class = shift; [...] my $tar = $class->new($file, $gzip); [...] } ...which, if list_archive was called as a method on an object, generates an error: Attempt to bless into a reference at /usr/share/perl5/vendor_perl/Archive/Tar.pm line 91. ...because new() did "return bless {...}, shift". This problem is shown by the File::Archive's test suite (version 0.53, test 5). Attached patch adds support for this case to new().
--- Archive-Tar-1.08/lib/Archive/Tar.pm~ 2004-04-26 15:15:49.041516984 +0200 +++ Archive-Tar-1.08/lib/Archive/Tar.pm 2004-04-26 15:16:22.226472104 +0200 @@ -85,10 +85,12 @@ } sub new { + my $class = shift; + $class = ref $class if ref $class; ### copying $tmpl here since a shallow copy makes it use the ### same aref, causing for files to remain in memory always. - my $obj = bless { _data => [ ], _file => 'Unknown' }, shift; + my $obj = bless { _data => [ ], _file => 'Unknown' }, $class; $obj->read( @_ ) if @_;
This syntax has never been valid, in even the earliest versions of Archive::Tar. However, since the patch is trivial and seems to solve someone else's problem, i've applied it... it's in Archive::Tar 1.10 which i've just uploaded to CPAN.