Test::Smoke::Patcher - OO interface to help patching the source-tree
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;
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.
The pfile attribute is a pointer to a single patch. There are four (4) ways to specify that patch.
The scalar holds the complete patch as literal text.
The array holds a list of lines (with newlines) that make up the patch as literal text ($patch = join "", @$array_ref).
$patch = join "", @$array_ref
You passed an opened filehandle to a file containing the patch.
If none of the above apply, it is assumed you passed a filename. Relative paths are rooted at the builddir (ddir attribute).
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.
new() crates the object. Valid types are single and multi. Valid keys for %args:
new()
%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
config() is an interface to the package lexical %CONFIG, which holds all the default values for the new() arguments.
config()
%CONFIG
With the special key all_defaults this returns a reference to a hash holding all the default values.
patch() is a simple dispatcher.
patch()
Try to run regen_headers.pl if the flag is set.
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.
patch_single()
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.
patch_multi()
_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!
_make_opts()
call_patch() opens a pipe to the patch program and prints $$ref_to_content to it. It will Carp::croak() on any error!
call_patch()
$$ref_to_content
patch, Test::Smoke::Syncer::Snapshot
(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.
To install Test::Smoke, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Smoke
CPAN shell
perl -MCPAN -e shell install Test::Smoke
For more information on module installation, please visit the detailed CPAN module installation guide.