NAME

Test::Smoke::BuildCFG - OO interface for handling build configurations

SYNOPSIS

use Test::Smoke::BuildCFG;

my $name = 'perlcurrent.cfg';
my $bcfg = Test::Smoke::BuildCFG->new( $name );

foreach my $config ( $bcfg->configurations ) {
    # do somthing with $config
}

DESCRIPTION

Handle the build configurations

METHODS

Test::Smoke::BuildCFG->new( [$cfgname] )

[ Constructor | Public ]

Initialise a new object.

Test::Smoke::BuildCFG->config( $key[, $value] )

[ Accessor | Public ]

config() is an interface to the package lexical %CONFIG, which holds all the default values for the new() arguments.

With the special key all_defaults this returns a reference to a hash holding all the default values.

$self->read_parse( $cfgname )

read_parse() reads the build configurations file and parses it.

$self->_read( $nameorref )

_read() is a private method that handles the reading.

Reference to a SCALAR build configurations are in $$nameorref
Reference to an ARRAY build configurations are in @$nameorref
Reference to a GLOB build configurations are read from the filehandle
Other values are taken as the filename for the build configurations
$self->_parse( )

_parse() will split the build configurations file in sections. Sections are ended with a line that begins with an equals-sign ('=').

There are two types of section

buildopt-section
policy-section

A policy-section contains a "target-option". This is a build option that should be in the ccflags variable in the Policy.sh file (see also Test::Smoke::Policy) and starts with a (forward) slash ('/').

A policy-section can have only one (1) target-option.

$self->_serialize( )

_serialize() creates a list of Test::Smoke::BuildCFG::Config objects from the parsed sections.

__build_list( $list, $previous_args, $policy_subst, $this_cfg, @cfgs )

Recursive sub, mainly taken from the old run_tests() in mktest.pl

$buildcfg->configurations( )

Returns the list of configurations (Test::Smoke::BuildCFG::Config objects)

Test::Smoke::BuildCFG->default_buildcfg()

This is a constant that returns a textversion of the default configuration.

PACKAGE

Test::Smoke::BuildCFG::Config - OO interface for a build confiuration

SYNOPSIS

my $bcfg = Test::Smoke::BuildCFG::Config->new( $args, $policy );

or

my $bcfg = Test::Smoke::BuildCFG::Config->new;
$bcfg->args( $args );
$bcfg->policy( [ -DDEBUGGING => '-DDEBUGGING' ], 
               [ -DPERL_COPY_ON_WRITE => '' ] );

if ( $bcfg->has_arg( '-Duseithreads' ) ) {
    # do stuff for -Duseithreads
}

DESCRIPTION

This is a simple object that holds both the build arguments and the policy substitutions. The build arguments are stored as a string and the policy subtitutions are stored as a list of lists. Each substitution is represented as a list with the two elements: the target and its substitute.

METHODS

Test::Smoke::BuildCFG::Config->new( [ $args[, \@policy_substs ]] )

Create the new object as an anonymous list.

$buildcfg->args( [$args] )

Accessor for the build arguments field.

$buildcfg->policy( [@substitutes] )

Accessor for the policy substitutions.

$self->_split_args( )

Create a hash with all the build arguments as keys.

$buildcfg->has_arg( $arg[,...] )

Check the build arguments hash for $arg. If you specify more then one the results will be logically ANDed!

$buildcfg->any_arg( $arg[,...] )

Check the build arguments hash for $arg. If you specify more then one the results will be logically ORed!

$buildcfg->args_eq( $args )

args_eq() takes a string of config arguments and returns true if $self has exactly the same args as the $args has.

There is the small matter of default_args (dfopts) kept as a Class variable in Test::Smoke::BuildCFG!

SEE ALSO

Test::Smoke::Smoker, Test::Smoke::Syncer::Policy

COPYRIGHT

(c) 2002-2003, All rights reserved.

* Abe Timmerman <abeltje@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See:

  • http://www.perl.com/perl/misc/Artistic.html

  • http://www.gnu.org/copyleft/gpl.html

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.