[svn:parrot] r36229 - in trunk: lib/Parrot lib/Parrot/Pmc2c tools/util

petdance at svn.parrot.org petdance at svn.parrot.org
Sun Feb 1 05:56:03 UTC 2009


Author: petdance
Date: Sun Feb  1 05:56:02 2009
New Revision: 36229
URL: https://trac.parrot.org/parrot/changeset/36229

Log:
more critic fixies

Modified:
   trunk/lib/Parrot/Configure.pm
   trunk/lib/Parrot/Headerizer.pm
   trunk/lib/Parrot/Pmc2c/Method.pm
   trunk/lib/Parrot/Revision.pm
   trunk/tools/util/perlcritic-cage.conf

Modified: trunk/lib/Parrot/Configure.pm
==============================================================================
--- trunk/lib/Parrot/Configure.pm	Sun Feb  1 04:48:34 2009	(r36228)
+++ trunk/lib/Parrot/Configure.pm	Sun Feb  1 05:56:02 2009	(r36229)
@@ -1,6 +1,11 @@
 # Copyright (C) 2001-2009, The Perl Foundation.
 # $Id$
 
+package Parrot::Configure;
+
+use strict;
+use warnings;
+
 =head1 NAME
 
 Parrot::Configure - Conducts the execution of Configuration Steps
@@ -33,11 +38,6 @@
 
 =cut
 
-package Parrot::Configure;
-
-use strict;
-use warnings;
-
 use lib qw(config);
 use Carp qw(carp);
 use Storable qw(2.12 nstore retrieve nfreeze thaw);
@@ -75,7 +75,7 @@
         data    => Parrot::Configure::Data->new,
         options => Parrot::Configure::Data->new,
     };
-    bless $singleton, "Parrot::Configure";
+    bless $singleton, 'Parrot::Configure';
 }
 
 sub new {
@@ -156,7 +156,7 @@
 
 sub get_list_of_steps {
     my $conf = shift;
-    die "list_of_steps not available until steps have been added"
+    die 'list_of_steps not available until steps have been added'
         unless defined $conf->{list_of_steps};
     return wantarray ? @{ $conf->{list_of_steps} } : $conf->{list_of_steps};
 }
@@ -233,7 +233,7 @@
     # If the --fatal option is true, then all config steps are mapped into
     # %steps_to_die_for and there is no consideration of --fatal-step.
     if ($fatal) {
-        %steps_to_die_for = map {$_, 1} @{ $conf->{list_of_steps} };
+        %steps_to_die_for = map { ($_,1) } @{ $conf->{list_of_steps} };
     }
     # We make certain that argument to --fatal-step is a comma-delimited
     # string of configuration steps, each of which is a string delimited by
@@ -292,10 +292,10 @@
     my $fatal_step_str = shift;
     my %steps_to_die_for = ();
     my $named_step_pattern = qr/(?:init|inter|auto|gen)::\w+/;
-    if ( $fatal_step_str =~ /^
+    if ( $fatal_step_str =~ m{^
         $named_step_pattern
         (, $named_step_pattern)*
-        $/x
+        $}x
     ) {
         my @fatal_steps = split /,/, $fatal_step_str;
         for my $s (@fatal_steps) {
@@ -303,7 +303,7 @@
         }
     }
     else {
-        die "Argument to 'fatal-step' option must be comma-delimited string of valid configuration steps";
+        die 'Argument to "fatal-step" option must be comma-delimited string of valid configuration steps';
     }
     return %steps_to_die_for;
 }
@@ -312,10 +312,10 @@
     my $verbose_step_str = shift;
     my %verbose_steps = ();
     my $named_step_pattern = qr/(?:init|inter|auto|gen)::\w+/;
-    if ( $verbose_step_str =~ /^
+    if ( $verbose_step_str =~ m{^
         $named_step_pattern
         (, $named_step_pattern)*
-        $/x
+        $}x
     ) {
         my @verbose_steps = split /,/, $verbose_step_str;
         for my $s (@verbose_steps) {
@@ -323,7 +323,7 @@
         }
     }
     else {
-        die "Argument to 'verbose-step' option must be comma-delimited string of valid configuration steps";
+        die 'Argument to "verbose-step" option must be comma-delimited string of valid configuration steps';
     }
     return %verbose_steps;
 }
@@ -350,7 +350,7 @@
         $conf->options->get(qw( verbose verbose-step ask ));
 
     my $task = ( $conf->steps() )[0];
-    if ( $task->{"Parrot::Configure::Task::step"} eq $taskname ) {
+    if ( $task->{'Parrot::Configure::Task::step'} eq $taskname ) {
         $conf->_run_this_step(
             {
                 task            => $task,
@@ -362,7 +362,7 @@
         );
     }
     else {
-        die "Mangled task in run_single_step";
+        die 'Mangled task in run_single_step';
     }
 
     return;

Modified: trunk/lib/Parrot/Headerizer.pm
==============================================================================
--- trunk/lib/Parrot/Headerizer.pm	Sun Feb  1 04:48:34 2009	(r36228)
+++ trunk/lib/Parrot/Headerizer.pm	Sun Feb  1 05:56:02 2009	(r36229)
@@ -201,11 +201,11 @@
     if ( $return_type =~ /\*/ ) {
         if ( !$macros{PARROT_CAN_RETURN_NULL} && !$macros{PARROT_CANNOT_RETURN_NULL} ) {
             $self->squawk( $file, $name,
-                "Returns a pointer, but no PARROT_CAN(NOT)_RETURN_NULL macro found." );
+                'Returns a pointer, but no PARROT_CAN(NOT)_RETURN_NULL macro found.' );
         }
         elsif ( $macros{PARROT_CAN_RETURN_NULL} && $macros{PARROT_CANNOT_RETURN_NULL} ) {
             $self->squawk( $file, $name,
-                "Can't have both PARROT_CAN_RETURN_NULL and PARROT_CANNOT_RETURN_NULL together." );
+                q{Can't have both PARROT_CAN_RETURN_NULL and PARROT_CANNOT_RETURN_NULL together.} );
         }
     }
 

Modified: trunk/lib/Parrot/Pmc2c/Method.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/Method.pm	Sun Feb  1 04:48:34 2009	(r36228)
+++ trunk/lib/Parrot/Pmc2c/Method.pm	Sun Feb  1 05:56:02 2009	(r36229)
@@ -27,6 +27,8 @@
 
     # this is usually wrong, but *something* calls new on an object somewhere
     bless $self, ref $class || $class;
+
+    return $self;
 }
 
 sub clone {
@@ -37,6 +39,8 @@
 sub add_mmd_rights {
     my ( $self, $value ) = @_;
     push @{ $self->{mmd_rights} }, $value;
+
+    return;
 }
 
 sub mmd_rights {

Modified: trunk/lib/Parrot/Revision.pm
==============================================================================
--- trunk/lib/Parrot/Revision.pm	Sun Feb  1 04:48:34 2009	(r36228)
+++ trunk/lib/Parrot/Revision.pm	Sun Feb  1 05:56:02 2009	(r36229)
@@ -60,14 +60,14 @@
     my ($cache, $revision) = @_;
     open my $FH, ">", $cache
         or die "Unable to open handle to $cache for writing: $!";
-    print $FH "$revision\n";
+    print {$FH} "$revision\n";
     close $FH or die "Unable to close handle to $cache after writing: $!";
 }
 
 sub _get_revision {
     my $revision;
     if (-f $cache) {
-        open my $FH, "<", $cache
+        open my $FH, '<', $cache
             or die "Unable to open $cache for reading: $!";
         chomp($revision = <$FH>);
         close $FH or die "Unable to close $cache after reading: $!";

Modified: trunk/tools/util/perlcritic-cage.conf
==============================================================================
--- trunk/tools/util/perlcritic-cage.conf	Sun Feb  1 04:48:34 2009	(r36228)
+++ trunk/tools/util/perlcritic-cage.conf	Sun Feb  1 05:56:02 2009	(r36229)
@@ -30,5 +30,6 @@
 
 [-ValuesAndExpressions::ProhibitConstantPragma]
 [-ValuesAndExpressions::ProhibitEmptyQuotes]
+[-ValuesAndExpressions::ProhibitMagicNumbers]
 
 [-Variables::ProhibitPunctuationVars]


More information about the parrot-commits mailing list