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

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

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



Subject: Catch exceptions coming out of PPI and skip those files
Running PPI over it's own source code, perlcritic barfs. The problem is with a specific check in 14_charsets.t to detect if PPI is going to be able to handle parsing unicode (because in non-unicode locales, PPI can't parse Unicode...). Of course, when PPI tries to parse this expression (that checks to see if it can parse the expression), it fails :) So it is somehow going to be necesary to catch exceptions coming out of PPI and skipping that file (at the very least on platforms that can't handle unicode). Adam K ----------------------------------------------------- C:\devel\cpan\trunk\PPI>perlcritic . .\Makefile.PL source OK .\inline2test.tpl source OK lib\PPI.pm source OK t\01_compile.t source OK t\02_api.t source OK t\03_empiric.t source OK t\04_element.t source OK t\05_lexer_practical.t source OK t\06_round_trip.t: Bareword file handle opened at line 62, column 13. See pages 202,204 of PBP. (Severity: 5) t\07_token.t source OK t\08_regression.t: One-argument "bless" used at line 75, column 16. See page 365 of PBP. (Severity: 5) t\08_regression.t: One-argument "bless" used at line 105, column 16. See page 365 of PBP. (Severity: 5) t\09_normal.t source OK t\10_statement.t source OK t\11_util.t source OK t\12_location.t source OK t\13_data.t source OK Warning: Can't parse code: Fatal error... regex failed to match in '#!/usr/bin/perl -w ' when expected at C:/strawberry-perl/perl/site/lib/PPI/Token/Word.pm line 137. for 't\14_charsets.t' at C:\strawberry-perl\perl\bin/perlcritic line 195 at C:\strawberry-perl\perl\bin/perlcritic line 202 main::critique('HASH(0xbae688)', '.\Makefile.PL', '.\inline2test.tpl', 'lib\PPI.pm', 't\01_compile.t', 't\02_api.t', 't\03_e mpiric.t', 't\04_element.t', 't\05_lexer_practical.t', ...) called at C:\strawberry-perl\perl\bin/perlcritic line 37 main::run() called at C:\strawberry-perl\perl\bin/perlcritic line 29
From: CLOTHO [...] cpan.org
On Fri Sep 29 04:07:12 2006, ADAMK wrote: Show quoted text
> Running PPI over it's own source code, perlcritic barfs. > > The problem is with a specific check in 14_charsets.t to detect if PPI > is going to be able to handle parsing unicode (because in non-unicode > locales, PPI can't parse Unicode...). > > Of course, when PPI tries to parse this expression (that checks to see > if it can parse the expression), it fails :) > > So it is somehow going to be necesary to catch exceptions coming out of > PPI and skipping that file (at the very least on platforms that can't > handle unicode). > > Adam K
Are you suggesting that when Perl::Critic can't analyze a file due to a parse error it should pass that file but with a warning message? Currently we just croak(), but perhaps that should be C<carp();return;>? Chris
Where do we stand on this issue? Personally, I'm content with croaking on all PPI failures. But if we do decide to catch PPI failures, then I would prefer to be very specific about the kinds of failures that Perl::Critic catches. Can you list the error messages that you think we should trap? -Jeff
From: CDOLAN [...] cpan.org
On Sun Nov 19 22:22:40 2006, THALJEF wrote: Show quoted text
> Where do we stand on this issue? Personally, I'm content with > croaking on all PPI failures. But if we do decide to catch PPI > failures, then I would prefer to be very specific about the kinds of > failures that Perl::Critic catches. Can you list the error messages > that you think we should trap? > > -Jeff
I think Perl::Critic should die on PPI failure, but Test::Perl::Critic should trap the exception and report a test failure. My personal solution to Unicode .pm files is to manually exclude them in my personal perlcritic.t test. If we want to get fancy, then Test::Perl::Critic should notice the special case of Unicode errors in PPI and emit a SKIP or TODO test.
Subject: Re: [rt.cpan.org #21772] Catch exceptions coming out of PPI and skip those files
Date: Mon, 20 Nov 2006 21:24:11 -0800 (PST)
To: bug-Perl-Critic [...] rt.cpan.org
From: Jeffrey Thalhammer <jeffrey_thalhammer [...] yahoo.com>
Show quoted text
> I think Perl::Critic should die on PPI failure, but > Test::Perl::Critic should trap the exception and > report a test failure.
That is the current behavior, so I'm going to mark this issue as "RESOLVED". Show quoted text
____________________________________________________________________________________ Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com