Permalink
Browse files

Applying patch submitted in

http://rt.perl.org/rt3/Ticket/Display.html?id=49364:  working toward
elimination of the 'args' attribute in the _init() routines in Parrot
configuration step classes, we eliminate code to handle those attributes
in Parrot::Configure and Parrot::Configure::Step and revise
documentation accodingly.


git-svn-id: https://svn.parrot.org/parrot/trunk@24673 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 38d9cbf commit 3477cc06f407360c2980d3249b5ca0170cbb1ccd @jkeenan jkeenan committed Jan 8, 2008
Showing with 112 additions and 312 deletions.
  1. +67 −67 Configure.pl
  2. +1 −2 MANIFEST
  3. +1 −18 docs/configuration.pod
  4. +2 −13 lib/Parrot/Configure.pm
  5. +1 −15 lib/Parrot/Configure/Step.pm
  6. +1 −2 lib/Parrot/Configure/Test.pm
  7. +1 −3 t/configure/005-run_one_step.t
  8. +1 −3 t/configure/006-bad_step.t
  9. +1 −3 t/configure/007-verbose_two.t
  10. +1 −3 t/configure/008-verbose_step_number.t
  11. +1 −3 t/configure/009-verbose_step_regex.t
  12. +1 −3 t/configure/010-verbose_step_num_uncalled.t
  13. +1 −3 t/configure/011-no_description.t
  14. +1 −3 t/configure/012-verbose.t
  15. +1 −3 t/configure/013-die.t
  16. +0 −104 t/configure/014-params.t
  17. +1 −3 t/configure/015-no_return.t
  18. +1 −3 t/configure/016-no_return_but_result.t
  19. +1 −3 t/configure/040-return_undef.t
  20. +1 −3 t/configure/041-return_undef.t
  21. +3 −3 t/configure/043-verbose_step_name.t
  22. +1 −3 t/configure/046-inter.t
  23. +1 −3 t/configure/047-inter.t
  24. +1 −3 t/configure/048-return_result_undef.t
  25. +1 −3 t/configure/060-silent.t
  26. +1 −2 t/configure/132-auto_arch-01.t
  27. +2 −3 t/configure/132-auto_arch-02.t
  28. +1 −2 t/configure/132-auto_arch-03.t
  29. +1 −2 t/configure/132-auto_arch-04.t
  30. +1 −2 t/configure/132-auto_arch-05.t
  31. +1 −2 t/configure/132-auto_arch-06.t
  32. +1 −2 t/configure/132-auto_arch-07.t
  33. +1 −2 t/configure/132-auto_arch-08.t
  34. +1 −2 t/configure/132-auto_arch-09.t
  35. +1 −2 t/configure/132-auto_arch-10.t
  36. +1 −2 t/configure/132-auto_arch-11.t
  37. +1 −2 t/configure/133-auto_cpu-01.t
  38. +1 −2 t/configure/133-auto_cpu-02.t
  39. +1 −2 t/configure/133-auto_cpu-03.t
  40. +1 −2 t/configure/142-auto_aio-01.t
  41. +1 −2 t/configure/142-auto_aio-02.t
  42. +1 −2 t/configure/142-auto_aio-03.t
  43. +1 −2 t/configure/142-auto_aio-04.t
View
@@ -3,6 +3,73 @@
# Copyright (C) 2001-2007, The Perl Foundation.
# $Id$
+use 5.008_000;
+use strict;
+use warnings;
+use lib 'lib';
+
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Options::Test;
+use Parrot::Configure::Messages qw(
+ print_introduction
+ print_conclusion
+);
+use Parrot::Configure::Step::List qw( get_steps_list );
+
+$| = 1; # $OUTPUT_AUTOFLUSH = 1;
+
+# Install Option text was taken from:
+#
+# autoconf (GNU Autoconf) 2.59
+# Written by David J. MacKenzie and Akim Demaille.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions. There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# from Parrot::Configure::Options
+my $args = process_options(
+ {
+ mode => 'configure',
+ argv => [@ARGV],
+ }
+);
+exit(1) unless defined $args;
+
+my $opttest = Parrot::Configure::Options::Test->new($args);
+
+# configuration tests will only be run if you requested them
+# as command-line option
+$opttest->run_configure_tests();
+
+my $parrot_version = $Parrot::Configure::Options::Conf::parrot_version;
+
+# from Parrot::Configure::Messages
+print_introduction($parrot_version);
+
+my $conf = Parrot::Configure->new;
+
+# from Parrot::Configure::Step::List
+$conf->add_steps( get_steps_list() );
+
+# from Parrot::Configure::Data
+$conf->options->set( %{$args} );
+
+# Run the actual steps
+# from Parrot::Configure
+$conf->runsteps or exit(1);
+
+# build tests will only be run if you requested them
+# as command-line option
+$opttest->run_build_tests();
+
+my $make = $conf->data->get('make');
+# from Parrot::Configure::Messages
+( print_conclusion( $conf, $make ) ) ? exit 0 : exit 1;
+
+################### DOCUMENTATION ###################
+
=head1 NAME
Configure.pl - Parrot's Configuration Script
@@ -291,73 +358,6 @@ =head1 SEE ALSO
=cut
-use 5.008_000;
-use strict;
-use warnings;
-use lib 'lib';
-
-use Parrot::Configure;
-use Parrot::Configure::Options qw( process_options );
-use Parrot::Configure::Options::Test;
-use Parrot::Configure::Messages qw(
- print_introduction
- print_conclusion
-);
-use Parrot::Configure::Step::List qw( get_steps_list );
-
-$| = 1; # $OUTPUT_AUTOFLUSH = 1;
-
-# Install Option text was taken from:
-#
-# autoconf (GNU Autoconf) 2.59
-# Written by David J. MacKenzie and Akim Demaille.
-#
-# Copyright (C) 2003 Free Software Foundation, Inc.
-# This is free software; see the source for copying conditions. There is NO
-# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-# from Parrot::Configure::Options
-my $args = process_options(
- {
- mode => 'configure',
- argv => [@ARGV],
- }
-);
-exit(1) unless defined $args;
-
-my $opttest = Parrot::Configure::Options::Test->new($args);
-
-# configuration tests will only be run if you requested them
-# as command-line option
-$opttest->run_configure_tests();
-
-my $parrot_version = $Parrot::Configure::Options::Conf::parrot_version;
-
-# from Parrot::Configure::Messages
-print_introduction($parrot_version);
-
-my $conf = Parrot::Configure->new;
-
-# from Parrot::Configure::Step::List
-$conf->add_steps( get_steps_list() );
-
-# from Parrot::Configure::Data
-$conf->options->set( %{$args} );
-
-# Run the actual steps
-# from Parrot::Configure
-$conf->runsteps or exit(1);
-
-# build tests will only be run if you requested them
-# as command-line option
-$opttest->run_build_tests();
-
-my $make = $conf->data->get('make');
-# from Parrot::Configure::Messages
-( print_conclusion( $conf, $make ) ) ? exit 0 : exit 1;
-
-################### DOCUMENTATION ###################
-
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
View
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Tue Jan 8 02:33:32 2008 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Tue Jan 8 03:15:35 2008 UT
#
# See tools/dev/install_files.pl for documentation on the
# format of this file.
@@ -3063,7 +3063,6 @@ t/configure/010-verbose_step_num_uncalled.t []
t/configure/011-no_description.t []
t/configure/012-verbose.t []
t/configure/013-die.t []
-t/configure/014-params.t []
t/configure/015-no_return.t []
t/configure/016-no_return_but_result.t []
t/configure/017-revision_no_DEVELOPING.t []
View
@@ -102,7 +102,6 @@ elements within an internal hash:
my $self = shift;
my %data;
$data{description} = q{This is the step description};
- $data{args} = [ qw( optional arguments ) ];
$data{result} = q{};
return \%data;
}
@@ -137,16 +136,6 @@ description when the step finishes executing; for example, the user will see:
Determining if your compiler supports computed goto...done.
-=item C<args>
-
-Returns a list of the names of any command-line arguments the step cares about.
-Command-line arguments are standardized in F<Configure.pl>; this will be
-described L<later|/"Command-line Arguments"> in more detail.
-
-I<XXX> Note that this method is currently unused but will be used in the futher
-to register acceptable CLI parameters. New steps should continue to define
-this method.
-
=item C<result>
The C<result> is initialized to an empty string mainly to quiet
@@ -160,8 +149,6 @@ value should be C<1> if the step accomplishes what it is intended to do.
Otherwise, the step should simply C<return>, I<i.e.>, return an
undefined value.
-I<XXX> In the near future there will be a means of passing additional parameters.
-
=back
The configuration system won't execute your step by default unless it's
@@ -178,7 +165,7 @@ A template for a new step might look like this:
use strict;
use warnings;
- use vars qw($description $result @args);
+ use vars qw($description $result);
use base qw(Parrot::Configure::Step);
@@ -188,7 +175,6 @@ A template for a new step might look like this:
my $self = shift;
my %data;
$data{description} = q{This is the step description};
- $data{args} = [ qw( optional arguments ) ];
$data{result} = q{};
return \%data;
}
@@ -238,9 +224,6 @@ Arguments passed to F<Configure.pl> are held in a L<Parrot::Configure::Data>
object stored inside the L<Parrot::Configure> object. The options data object
may be accessed via the L<Parrot::Configure/options> method.
-Steps use the C<args> method to list any options they're interested in. They
-should be listed without the dashes.
-
=head2 Building Up Configuration Data
The second step is F<config/init/defaults.pm>, which sets up some defaults in a
View
@@ -48,7 +48,6 @@ use Class::Struct;
struct(
'Parrot::Configure::Task' => {
step => '$',
- params => '@',
object => 'Parrot::Configure::Step',
},
);
@@ -175,12 +174,11 @@ Parrot::Configure object.
=cut
sub add_step {
- my ( $conf, $step, @params ) = @_;
+ my ( $conf, $step ) = @_;
push @{ $conf->{steps} },
Parrot::Configure::Task->new(
step => $step,
- params => \@params,
);
return 1;
@@ -354,7 +352,6 @@ sub _run_this_step {
my $args = shift;
my $step_name = $args->{task}->step;
- my @step_params = @{ $args->{task}->params };
eval "use $step_name;";
die $@ if $@;
@@ -399,15 +396,7 @@ sub _run_this_step {
my $ret;
# When successful, a Parrot configuration step now returns 1
- eval {
- if (@step_params)
- {
- $ret = $step->runstep( $conf, @step_params );
- }
- else {
- $ret = $step->runstep($conf);
- }
- };
+ eval { $ret = $step->runstep($conf); };
if ($@) {
carp "\nstep $step_name died during execution: $@\n";
return;
@@ -69,20 +69,6 @@ sub description {
return $self->{description};
}
-=item * C<args()>
-
-Accepts no arguments. In list context, returns a list of elements held in the
-C<args> attribute set in the C<_init()> initializer in the inheriting class's
-namespace. In scalar context, returns a reference to an array holding that
-same list.
-
-=cut
-
-sub args {
- my $self = shift;
- return wantarray ? @{$self->{args}} : $self->{args};
-}
-
=item * C<set_result()>
Accepts a scalar value and assigns it to the inheriting class's C<$result>
@@ -117,7 +103,7 @@ Joshua Hoblitt C<jhoblitt@cpan.org>
=head1 SEE ALSO
F<docs/configuration.pod>, L<Parrot::Configure>, L<Parrot::Configure::Data>,
-L<Parrot::Configure::Step>
+L<Parrot::Configure::Compiler>
=cut
@@ -23,14 +23,13 @@ sub stepnum {
sub test_step_thru_runstep {
my ( $conf, $pkg, $args ) = @_;
- my ( $task, $step_name, @step_params, $step, $ret );
+ my ( $task, $step_name, $step, $ret );
$conf->add_steps($pkg);
$conf->options->set( %{$args} );
$task = $conf->steps->[ stepnum() ];
$step_name = $task->step;
- @step_params = @{ $task->params };
$step = $step_name->new();
ok( defined $step, "$step_name constructor returned defined value" );
@@ -6,7 +6,7 @@
use strict;
use warnings;
-use Test::More tests => 22;
+use Test::More tests => 21;
use Carp;
use lib qw( lib t/configure/testlib );
use Parrot::Configure;
@@ -59,8 +59,6 @@ foreach my $k (@confsteps) {
}
is( $nontaskcount, 0, "Each step is a Parrot::Configure::Task object" );
is( $confsteps[0]->step, $step, "'step' element of Parrot::Configure::Task struct identified" );
-is( ref( $confsteps[0]->params ),
- 'ARRAY', "'params' element of Parrot::Configure::Task struct is array ref" );
ok( !ref( $confsteps[0]->object ),
"'object' element of Parrot::Configure::Task struct is not yet a ref" );
@@ -6,7 +6,7 @@
use strict;
use warnings;
-use Test::More tests => 12;
+use Test::More tests => 11;
use Carp;
use lib qw( lib );
use Parrot::Configure;
@@ -41,8 +41,6 @@ foreach my $k (@confsteps) {
}
is( $nontaskcount, 0, "Each step is a Parrot::Configure::Task object" );
is( $confsteps[0]->step, $badstep, "'step' element of Parrot::Configure::Task struct identified" );
-is( ref( $confsteps[0]->params ),
- 'ARRAY', "'params' element of Parrot::Configure::Task struct is array ref" );
ok( !ref( $confsteps[0]->object ),
"'object' element of Parrot::Configure::Task struct is not yet a ref" );
@@ -6,7 +6,7 @@
use strict;
use warnings;
-use Test::More tests => 13;
+use Test::More tests => 12;
use Carp;
use lib qw( lib t/configure/testlib );
use Parrot::Configure;
@@ -42,8 +42,6 @@ foreach my $k (@confsteps) {
}
is( $nontaskcount, 0, "Each step is a Parrot::Configure::Task object" );
is( $confsteps[0]->step, $step, "'step' element of Parrot::Configure::Task struct identified" );
-is( ref( $confsteps[0]->params ),
- 'ARRAY', "'params' element of Parrot::Configure::Task struct is array ref" );
ok( !ref( $confsteps[0]->object ),
"'object' element of Parrot::Configure::Task struct is not yet a ref" );
@@ -6,7 +6,7 @@
use strict;
use warnings;
-use Test::More tests => 13;
+use Test::More tests => 12;
use Carp;
use lib qw( lib t/configure/testlib );
use Parrot::Configure;
@@ -42,8 +42,6 @@ foreach my $k (@confsteps) {
}
is( $nontaskcount, 0, "Each step is a Parrot::Configure::Task object" );
is( $confsteps[0]->step, $step, "'step' element of Parrot::Configure::Task struct identified" );
-is( ref( $confsteps[0]->params ),
- 'ARRAY', "'params' element of Parrot::Configure::Task struct is array ref" );
ok( !ref( $confsteps[0]->object ),
"'object' element of Parrot::Configure::Task struct is not yet a ref" );
Oops, something went wrong.

0 comments on commit 3477cc0

Please sign in to comment.