Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic CPAN distribution.

Report information
The Basics
Id: 57640
Status: open
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors: dolmen [...] cpan.org
Cc:
AdminCc:

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



Subject: Subroutines::RequireFinalReturn should ignore DESTROY sub
The special sub DESTROY (object destructor) never returns a value. Subroutines::RequireFinalReturn should ignore it. -- Olivier Mengué - http://o.mengue.free.fr/
Subject: Re: [rt.cpan.org #57640] Subroutines::RequireFinalReturn should ignore DESTROY sub
Date: Wed, 19 May 2010 19:17:34 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
On 5/19/10 12:58 PM, Olivier 'dolmen' Mengué via RT wrote: Show quoted text
> The special sub DESTROY (object destructor) never returns a value. > > Subroutines::RequireFinalReturn should ignore it.
Yes, it does. All subroutines return values. No exceptions. It's just that when it gets called as a destructor, the VM ignores the return value. Plus, there's nothing stopping someone from invoking DESTROY directly. Yes, it would be stupid to do so, but there's nothing preventing it.
Le Mer 19 Mai 2010 20:17:44, clonezone a écrit : Show quoted text
> On 5/19/10 12:58 PM, Olivier 'dolmen' Mengué via RT wrote:
> > The special sub DESTROY (object destructor) never returns a value. > > > > Subroutines::RequireFinalReturn should ignore it.
> > Yes, it does. All subroutines return values. No exceptions. It's > just that when it gets called as a destructor, the VM ignores the > return value. > > Plus, there's nothing stopping someone from invoking DESTROY directly. > Yes, it would be stupid to do so, but there's nothing preventing it.
OK. I understand. But could you add an option that would permit to relax that rules for a list of subs? Currently it is all or nothing. I propose: ignore_subs = DESTROY -- Olivier Mengué - http://o.mengue.free.fr/