# 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 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 Basic constructor. Accepts no arguments and returns a L object. Requires user to define an C<_init()> method in the inheriting configuration class. This initializer sets a C attribute in the object's data structure and may set other attributes as well. Should the initializer fail to set a C attribute, the constructor sets it to be an empty string. Hence, when a configuration step is executed by L, 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 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 Accepts no arguments. In list context, returns a list of elements held in the C 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 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 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 =head1 SEE ALSO F, L, L, L =cut 1; # Local Variables: # mode: cperl # cperl-indent-level: 4 # fill-column: 100 # End: # vim: expandtab shiftwidth=4: