Login
Correct the code commited in revision 4098 (allowing loads of specific
authorTom Wyant <harryfmudd@comcast.net>
Thu, 8 Dec 2011 23:56:11 +0000 (23:56 +0000)
committerTom Wyant <harryfmudd@comcast.net>
Thu, 8 Dec 2011 23:56:11 +0000 (23:56 +0000)
modules before the package statement in
Modules::RequireExplicitPackage). The original code tested for a defined
return from PPI::Statement::Include->module(), but that method returns
'' for 'use 5.010;'.

lib/Perl/Critic/Policy/Modules/RequireExplicitPackage.pm

index 5f2a12a..ac59dce 100644 (file)
@@ -93,7 +93,7 @@ sub _is_statement_of_interest {
         and return $FALSE;
 
     if ( $elem->isa( 'PPI::Statement::Include' ) ) {
-        if ( defined( my $module = $elem->module() ) ) {
+        if ( my $module = $elem->module() ) {
             $self->{_allow_import_of}{$module}
                 and return $FALSE;
         }