Abe Timmerman > Test-Smoke-1.6 > Test::Smoke::Patcher

Download:
Test-Smoke-1.6.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  15
Open  4
Stalled  1
View/Report Bugs
Module Version: 0.011   Source   Latest Release: Test-Smoke-1.61_03

NAME ^

Test::Smoke::Patcher - OO interface to help patching the source-tree

SYNOPSIS ^

    use Test::Smoke::Patcher;

    my $patcher = Test::Smoke::Patcher->new( single => {
        ddir  => $build_dir,
        pfile => $patch,
        popts => '-p1',
        v     => 1, # 0..2
    });
    $patcher->patch;

or

    my $patcher = Test::Smoke::Patcher->new( multi => {
        ddir  => $buildir,
        pfile => $patch_info,
        v     => 1, #0..2
    });
    $patcher->patch;

DESCRIPTION ^

Okay, you will need a working patch program, which I believe is available for most platforms perl runs on.

There are two ways to initialise the Test::Smoke::Patcher object.

single mode

The pfile attribute is a pointer to a single patch. There are four (4) ways to specify that patch.

refernece to a SCALAR

The scalar holds the complete patch as literal text.

reference to an ARRAY

The array holds a list of lines (with newlines) that make up the patch as literal text ($patch = join "", @$array_ref).

reference to a GLOB

You passed an opened filehandle to a file containing the patch.

filename

If none of the above apply, it is assumed you passed a filename. Relative paths are rooted at the builddir (ddir attribute).

multi mode

The pfile attribute is a pointer to a recource that contains filenames of patches. The format of this recource is one filename per line optionally followed by a semi-colon (;) and switches for the patch program.

The patch-resource can also be specified in four (4) ways.

reference to a SCALAR
reference to an ARRAY
reference to a GLOB
filename

METHODS ^

Test::Smoke::Patcher->new( $type => \%args );

new() crates the object. Valid types are single and multi. Valid keys for %args:

    * ddir:     the build directory
    * fdir:     the intermediate forest dir (preferred)
    * pfile:    path to either the patch (single) or a textfile (multi)
    * popts:    options to pass to 'patch' (-p1)
    * patchbin: full path to the patch binary (patch)
    * v:        verbosity 0..2
Test::Smoke::Patcher->config( $key[, $value] )

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.

$patcher->patch

patch() is a simple dispatcher.

perl_regen_headers( )

Try to run regen_headers.pl if the flag is set.

$patcher->patch_single( )

patch_single() checks if the pfile attribute is a plain scalar or a ref to a scalar, array, glob. In the first case this is taken to be a filename. A GLOB-ref is a filehandle, the other two are taken to be literal content.

$patcher->patch_multi( )

patch_multi() checks the pfile attribute is a plain scalar or a ref to a scalar, array, glob. In the first case this is taken to be a filename. A GLOB-ref is a filehandle, the other two are taken to be literal content.

$self->_make_opts( $switches )

_make_opts() just creates a string of options to pass to the patch program. Some implementations of patch do not grog '-u', so be careful!

$patcher->call_patch( $ref_to_content )

call_patch() opens a pipe to the patch program and prints $$ref_to_content to it. It will Carp::croak() on any error!

SEE ALSO ^

patch, Test::Smoke::Syncer::Snapshot

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:

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.

syntax highlighting: