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: 38074
Status: open
Priority: 0/
Queue: Perl-Critic

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

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



Subject: Suggested policy: don't use the same module twice in the same source file
A policy to warn about use Some::Module; use Some::Module; or similar.
Subject: Re: [rt.cpan.org #38074] Suggested policy: don't use the same module twice in the same source file
Date: Thu, 31 Jul 2008 10:01:32 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
EDAVIS via RT wrote: Show quoted text
> A policy to warn about > > use Some::Module; > use Some::Module;
How does that work in the face of stuff like use Moose; no Moose; use Moose;
Subject: Re: [rt.cpan.org #38074] Suggested policy: don't use the same module twice in the same source file
Date: Thu, 31 Jul 2008 10:11:52 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Elliot Shank via RT wrote: Show quoted text
> EDAVIS via RT wrote:
>> A policy to warn about >> >> use Some::Module; >> use Some::Module;
> > How does that work in the face of stuff like > > use Moose; > no Moose; > use Moose;
Also, it would need to handle multiple package declarations in a single file that each pull in a given module (yes, this isn't nice, but it's a separate, existing, policy).
Good points. I suggest splitting the source file into package sections and warning if 'use X' appears twice in the same package. If 'no X' appears in a package section then all warnings for 'use X' are suppressed in that package section.