Skip Menu |

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

Report information
The Basics
Id: 56925
Status: open
Priority: 0/
Queue: Class-Std

People
Owner: Nobody in particular
Requestors: Ian.Goodacre [...] xtra.co.nz
Cc:
AdminCc:

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



Subject: 'used only once' warning from DESTROY
The DESTROY sub can trigger a 'used only once' warning if it is executed during the compile phase. For example, some uses of Config::Std cause a 'used only once' warning to be produced for Config::Std::Hash::DEMOLISH. While it might be a rare case that produces the warning, it can be avoided by disabling warnings 'once' in sub DESTROY. $ diff -u Class/Std.pm /usr/share/perl5/Class/Std.pm --- Class/Std.pm 2010-04-26 21:50:09.000000000 +1200 +++ /usr/share/perl5/Class/Std.pm 2010-04-26 21:49:22.000000000 +1200 @@ -520,6 +520,7 @@ DEMOLISH: for my $base_class (_hierarchy_of(ref $_[0])) { no strict 'refs'; + no warnings 'once'; if (my $demolish_ref = *{$base_class.'::DEMOLISH'}{CODE}) { &{$demolish_ref}; }
Subject: Re: [rt.cpan.org #56925] 'used only once' warning from DESTROY
Date: Thu, 29 Apr 2010 07:12:59 +1000
To: bug-Class-Std [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Show quoted text
> The DESTROY sub can trigger a 'used only once' warning if it is executed > during the compile phase. For example, some uses of Config::Std cause a > 'used only once' warning to be produced for Config::Std::Hash::DEMOLISH. > > While it might be a rare case that produces the warning, it can be > avoided by disabling warnings 'once' in sub DESTROY.
Added for the next release. Thanks, Ian! Damian