# Copyright (C) 2001-2005, The Perl Foundation.
# $Id: Base.pm 22195 2007-10-18 01:51:52Z jkeenan $
=pod
=head1 NAME
Parrot::Configure::Step::Base - Configuration Step Base Class
=head1 SYNOPSIS
use base qw(Parrot::Configure::Step::Base);
=head1 DESCRIPTION
The C<Parrot::Configure::Step::Base> module contains the constructor and
utility methods that should be inherited by all configuration steps.
=head1 USAGE
=cut
package Parrot::Configure::Step::Base;
use strict;
use warnings;
=head2 Methods
=over 4
=item * C<new()>
Basic constructor.
Accepts no arguments and returns a L<Parrot::Configure::Step::> object.
Requires user to define an C<_init()> method in the inheriting configuration
class. This initializer sets a C<description> attribute in the object's data
structure and may set other attributes as well. Should the initializer fail
to set a C<description> attribute, the constructor sets it to be an empty
string. Hence, when a configuration step is executed by L<Configure.pl>, the
description for that step is always defined but may not be a true value.
=cut
sub new {
my $class = shift;
my $self = bless {}, $class;
my $dataref = $self->_init($class);
%$self = %$dataref;
unless ( defined ($self->{description}) ) {
$self->{description} = q{};
}
return $self;
}
=item * C<description()>
Accepts no arguments and returns the value of the description attribute. The
description ought to be set in the C<_init()> initializer in the inheriting
class's namespace. If it was not set there, the constructor sets it to an
empty string.
=cut
sub description {
my $self = shift;
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>
variable. Returns the inheriting class's name.
=cut
sub set_result {
my ( $self, $result ) = @_;
$self->{result} = $result;
return $self;
}
=item * C<result()>
Accepts no arguments and returns the value of C<$result> from the inheriting
class's namespace.
=cut
sub result {
my $self = shift;
return $self->{result};
}
=back
=head1 AUTHOR
Joshua Hoblitt C<jhoblitt@cpan.org>
=head1 SEE ALSO
F<docs/configuration.pod>, L<Parrot::Configure>, L<Parrot::Configure::Data>,
L<Parrot::Configure::Step>
=cut
1;
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4:
syntax highlighted by Code2HTML, v. 0.9.1