lokku / Perl-Critic-Lokku

A collection of Perl::Critic policies
https://metacpan.org/pod/Perl::Critic::Lokku
0 stars 4 forks source link

TryTiny::RequireCatch fails when using try in a conditional #1

Closed bk2204 closed 7 years ago

bk2204 commented 7 years ago

With the following code, this policy throws an exception because there's no next sibling:

#!/usr/bin/env perl

use Try::Tiny;

my $x = {};
if ( !try { $x->isa('Foo') } ) {
    print "Not a Foo.\n";
}

Error:

brianc64 ok % perlcritic --single-policy TryTiny::RequireCatch  example.pl
Fatal error while critiquing "example.pl": Can't call method "content" without a package or object reference at /usr/local/cpanel/3rdparty/perl/524/lib64/perl5/cpanel_lib/Perl/Critic/Policy/TryTiny/RequireCatch.pm line 56.