Skip Menu |

This queue is for tickets about the Class-Std CPAN distribution.

Report information
The Basics
Id: 24998
Status: new
Priority: 0/
Queue: Class-Std

People
Owner: Nobody in particular
Requestors: simon [...] tinhinan.net
Cc:
AdminCc:

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



Subject: DEMOLISH fails when using my $self = shift
Date: Fri, 16 Feb 2007 14:32:06 +0100 (CET)
To: bug-Class-Std [...] rt.cpan.org
From: "Simon Day" <simon [...] tinhinan.net>
DEMOLISH fails to work on the parent class when is a derived class uses my $self = shift While in the case of DEMOLISH it may be more sensible to use ($self, $ident) = @_ (which works without a problem) using shift should probably not leave it broken (as it is now) failing in a very strange manner. The problem is that the shift is affecting the @_ is the Class::Std::DESTROY routing - which is being passed in turn to each $base_class::DEMOLISH I suspect this is a side effect of the way each demolish is called though I'm not familiar enough with internals to be certain. A simple solution (though there may be a much ore elegant one) is to reset the @_ array to ($self, $id) in Class::Std::DESTROY before each $base_class::DEMOLISH is called Patch below Simon Day --- Std.pm.old 2007-02-16 09:12:54.813173000 +0100 +++ Std.pm 2007-02-16 14:23:30.181562000 +0100 @@ -520,6 +522,7 @@ DEMOLISH: for my $base_class (_hierarchy_of(ref $_[0])) { no strict 'refs'; + @_ = ($self, $id); if (my $demolish_ref = *{$base_class.'::DEMOLISH'}{CODE}) { &{$demolish_ref}; }