Subject: | ProhibitParensWithBuiltins dies when bare "undef" is encountered |
Just playing with Perl::Critic and noticed a few conditions which cause
the code to barf:
#!/usr/bin/perl -w
use strict;
use warnings;
my %params = ();
my $config_ref = {
_page_count => ( exists $params{page_count} ? $params{page_count} :
undef ),
_size => $params{size} || undef
};
Both the "undef )" on the _page_count line and the trailing undef on the
_size line cause the module to barf with the error
Can't call method "isa" without a package or object reference at
xxx/ProhibitParensWithBuiltins.pm line 22.
This is because $sib is empty in both cases.
I appreciate that the code isn't guideline-compliant, but it shouldn't
just die ;-)
I have tweaked the code and it now works OK. Adding a trailing comma to
the second one works (by making $sib a comma) but using a constant var
$UNDEF works for both.