File Coverage

File:lib/Parrot/Configure/Step.pm
Coverage:100.0%

linestmtbrancondsubcode
1# Copyright (C) 2001-2005, Parrot Foundation.
2
3 - 20
=pod

=head1 NAME

Parrot::Configure::Step - Configuration step base class

=head1 SYNOPSIS

    use base qw(Parrot::Configure::Step);

=head1 DESCRIPTION

The C<Parrot::Configure::Step> module contains the constructor and
utility methods that should be inherited by all configuration steps.

=head1 USAGE

=cut
21
22package Parrot::Configure::Step;
23
24
92
92
92
use strict;
25
92
92
92
use warnings;
26
92
92
92
use base qw( Parrot::Configure::Step::Methods );
27
28 - 44
=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
45
46sub new {
47
277
    my $class = shift;
48
277
    my $self = bless {}, $class;
49
277
    my $dataref = $self->_init($class);
50
277
    %$self = %$dataref;
51
277
    unless ( defined ($self->{description}) ) {
52
2
        $self->{description} = q{};
53    }
54
277
    return $self;
55}
56
57 - 64
=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
65
66sub description {
67
348
    my $self = shift;
68
348
    return $self->{description};
69}
70
71 - 76
=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
77
78sub set_result {
79
267
    my ( $self, $result ) = @_;
80
267
    $self->{result} = $result;
81
267
    return $self;
82}
83
84 - 89
=item * C<result()>

Accepts no arguments and returns the value of C<$result> from the inheriting
class's namespace.

=cut
90
91sub result {
92
256
    my $self = shift;
93
256
    return $self->{result};
94}
95
96=back
97
98 - 107
=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::Compiler>

=cut
108
1091;
110
111# Local Variables:
112# mode: cperl
113# cperl-indent-level: 4
114# fill-column: 100
115# End:
116# vim: expandtab shiftwidth=4: