Closed Tux closed 9 years ago
--- Perl/Critic/Policy/Freenode/StrictWarnings.pm 2015-07-31 04:34:33.000000000 +0200
+++ Perl/Critic/Policy/Freenode/StrictWarnings.pm 2015-08-14 11:07:59.355095463 +0200
@@ -54,9 +54,14 @@ sub violates {
$has_warnings = 1 if $include->pragma eq 'warnings';
}
if ($include->type//'' eq 'use') {
- $has_strict = 1 if $include->version and $include->version_literal > 5.012;
- $has_strict = 1 if defined $include->module and exists $strict_importers{$include->module};
- $has_warnings = 1 if defined $include->module and exists $warnings_importers{$include->module};
+ my $version = $include->version_literal || 0;
+ $version =~ m/^\x05([\x00-\x63])([\x00-\x63])$/ and
+ $version = sprintf "5.%03d%03d", ord $1, ord $2;
+ $version =~ m/^5\.([0-9][0-9])\.([0-9][0-9]?)$/ and
+ $version = sprintf "5.%03d%03d", $1, $2;
+ $has_strict = 1 if defined $include->version and $version > 5.012;
+ $has_strict = 1 if defined $include->module and exists $strict_importers{$include->module};
+ $has_warnings = 1 if defined $include->module and exists $warnings_importers{$include->module};
}
return () if $has_strict and $has_warnings;
}
Here 'use 5.14.2' implies 'use strict' (plus a bit more), and that would be the exception to the "version string used" warning.