Author: jkeenan
Date: Sun Mar 25 18:03:04 2007
New Revision: 17754

Modified:
   branches/reconfigure/Configure.pl
   branches/reconfigure/config/init/defaults.pm

Log:
So as to eliminate global (our) variables $parrot_version and @parrot_version,
(a) called only Parrot::BuildUtil::parrot_version() in scalar context in
Configure.pl; (b) called that same subroutine in both scalar and list contexts
in config/init/defaults.pm.  The extra expense of calling one subroutine twice
will be compensated by increased code encapsulation and testability.


Modified: branches/reconfigure/Configure.pl
==============================================================================
--- branches/reconfigure/Configure.pl   (original)
+++ branches/reconfigure/Configure.pl   Sun Mar 25 18:03:04 2007
@@ -5,6 +5,7 @@
 use strict;
 use warnings;
 use Data::Dumper;
+$Data::Dumper::Indent = 1;
 use lib 'lib';
 
 use Parrot::BuildUtil;
@@ -16,9 +17,7 @@
 );
 use Parrot::Configure::Step::List qw( get_steps_list );
 
-# These globals are accessed in config/init/defaults.pm
-our $parrot_version = Parrot::BuildUtil::parrot_version();
-our @parrot_version = Parrot::BuildUtil::parrot_version();
+my $parrot_version = Parrot::BuildUtil::parrot_version();
 
 $| = 1; # $OUTPUT_AUTOFLUSH = 1;
 
@@ -45,6 +44,7 @@
 print_introduction($parrot_version);
 
 my $conf = Parrot::Configure->new;
+
 $conf->add_steps(get_steps_list());
 
 $conf->options->set(%args);

Modified: branches/reconfigure/config/init/defaults.pm
==============================================================================
--- branches/reconfigure/config/init/defaults.pm        (original)
+++ branches/reconfigure/config/init/defaults.pm        Sun Mar 25 18:03:04 2007
@@ -22,6 +22,7 @@
 use Config;
 use FindBin;    # see build_dir
 use Parrot::Configure::Step;
+use Parrot::BuildUtil;
 use Cwd qw(abs_path);
 use File::Spec;
 
@@ -29,6 +30,9 @@
 
 @args = qw(debugging optimize profile verbose m);
 
+my $parrot_version = Parrot::BuildUtil::parrot_version();
+my @parrot_version = Parrot::BuildUtil::parrot_version();
+
 sub runstep {
     my ( $self, $conf ) = @_;
 
@@ -169,10 +173,10 @@
         lns   => $Config{lns},                          # soft link
         slash => '/',
 
-        VERSION => $main::parrot_version,
-        MAJOR   => $main::parrot_version[0],
-        MINOR   => $main::parrot_version[1],
-        PATCH   => $main::parrot_version[2],
+        VERSION => $parrot_version,
+        MAJOR   => $parrot_version[0],
+        MINOR   => $parrot_version[1],
+        PATCH   => $parrot_version[2],
         DEVEL   => ( -e 'DEVELOPING' ? '-devel' : '' ),
 
         configdate => scalar localtime,

Reply via email to