Subject: | Subroutines::ProhibitCallsToUndeclaredSubs thinks 0xA0 is calling the sub 'A0' |
For some reason:
my $x = 0xA0
Fails under the guise of it being apparently parsed as:
'0' x ( A0() )
At least, thats the best I think I can imagine based on what I'm seeing.
Either way, here is an attached test that replicates the error.
my $x = 0xA0
Fails under the guise of it being apparently parsed as:
'0' x ( A0() )
At least, thats the best I think I can imagine based on what I'm seeing.
Either way, here is an attached test that replicates the error.
Subject: | hex-isnt-sub.t |
#!/usr/bin/env perl
# FILENAME: test.pl
# CREATED: 07/21/14 02:49:11 by Kent Fredric (kentnl) <kentfredric@gmail.com>
# ABSTRACT: Test critic policy for 0xA0
use strict;
use warnings;
use utf8;
use Test::More;
use Perl::Critic::TestUtils qw(pcritique pcritique_with_violations);
local $@;
my $x;
my $fatal = 1;
my $code = <<'EOF';
$x = 0xA0;
$fatal = 0;
EOF
eval $code;
is( $fatal, 0, 'Given code has no errors' ) or diag explain $@;
is( $x, 160, 'X is expected value' );
my @violations = pcritique_with_violations( 'Subroutines::ProhibitCallsToUndeclaredSubs', \$code );
is( scalar @violations, 0, "No violations" ) or diag explain \@violations;