Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #40598] [PATCH] Make perlcritic.t barf more nicely when Test::Perl::Critic not installed

7 views
Skip to first unread message

Paul Cochrane

unread,
Oct 26, 2006, 6:21:48 AM10/26/06
to bugs-bi...@rt.perl.org
# New Ticket Created by "Paul Cochrane"
# Please include the string: [perl #40598]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=40598 >


Hi,

this patch ensures that when t/codingstd/perlcritic.t can't find
Test::Perl::Critic, that instead of exiting with a "Can't locate
Test/Perl/Critic.pm in @INC" compile-time error, it reports that it is
skipping the test with the message defined in perlcritic.t.

One can't use C<require> in this case as the C<use> call needs to pass
an argument to the package if Test::Perl::Critic is found.

Comments welcome,

Paul

files affected:

t/codingstd/perlcritic.t

perlcritic_t.patch

Chris Dolan

unread,
Oct 26, 2006, 10:08:33 AM10/26/06
to perl6-i...@perl.org, bugs-bi...@rt.perl.org
On Oct 26, 2006, at 5:21 AM, Paul Cochrane (via RT) wrote:

> this patch ensures that when t/codingstd/perlcritic.t can't find
> Test::Perl::Critic, that instead of exiting with a "Can't locate
> Test/Perl/Critic.pm in @INC" compile-time error, it reports that it is
> skipping the test with the message defined in perlcritic.t.
>
> One can't use C<require> in this case as the C<use> call needs to pass
> an argument to the package if Test::Perl::Critic is found.
>
> Comments welcome,

Paul,

A better implementation of that patch would be:

BEGIN {
eval { require Test::Perl::Critic; };
if ($@) {
plan skip_all => 'Test::Perl::Critic not installed';
}
Test::Perl::Critic->import(-verbose => 7);

Chris

Paul Cochrane

unread,
Oct 26, 2006, 10:23:04 AM10/26/06
to parrotbug...@parrotcode.org
> A better implementation of that patch would be:
>
> BEGIN {
> eval { require Test::Perl::Critic; };
> if ($@) {
> plan skip_all => 'Test::Perl::Critic not installed';
> }
> Test::Perl::Critic->import(-verbose => 7);
>

Thanks Chris! I didn't know how to maintain the verbose flag any
other way, but now I know. With every patch my perl foo improves...
See attached patch for latest version.

BTW: did you get the perl shebang line patches for Perl::Critic?

Paul

perlcritic_t.patch
0 new messages