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:
24665
Status:
rejected
Priority:
Low/Low
Queue:

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

BugTracker
Severity:
Normal
Broken in:
1.01
Fixed in:
(no value)



#! /usr/bin/perl use Switch; use strict; use warnings; our $VERSION = 0.01; sub foo { switch $test { case 'a' {print 'a'} } } Subroutine does not end with "return" at line 9, column 1. See page 197 of PBP. (Severity: 4) Adding ';' after the '}' that closes the switch resolves the problem
Subject: Return not recognized after switch {}
I was so anxious to get a minimal test case, that I missed the most important part. Please add "return;" after the switch.
Subject: Perl::Critic does not detect return; after switch{}
From: THALJEF@cpan.org
Switch.pm uses a source filter to do its magic. Since Perl::Critic can't compile your code and PPI has no idea what kind of new syntax the source filter introduces, all bets are off. This is just an inherent problem of static analysis for dynamic languages. The problem is that PPI sees the return statement as a continuation of the switch block. As you pointed out, putting the semi-colon after the block solves the problem, because PPI now sees them as separate statements. I can understand if that's not an attractive solution, but it is probably the best we can do :( -Jeff


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.