Test::S...Patcher(3)
π NAME π
Test::Smoke::Patcher β the OO interface that helps you patch the source-tree, bestie. This page is Test::S...Patcher(3) from the User Contributed Perl Documentation, and yes it's exactly as much of a vibe as it sounds. π
β¨ 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 so first things first, bestie: you will need a working patch program, which β slay β is available for most platforms perl runs on. π
There are two ways to initialise the Test::Smoke::Patcher object. Pick your fighter:
π¦ single mode π¦
Here the pfile attribute is a pointer to a single patch. And there are four (4) ways to specify that patch:
- reference 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 (the
ddirattribute).
πΈ multi mode πΈ
Here the pfile attribute is a pointer to a resource that contains filenames of patches. The format of this resource 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
π TRY_REGEN_HEADERS π
Constant: 1
π MAX_FLAG_COUNT π
Constant: 16
π ALL_FLAGS π
Constant: 2**MAX_FLAG_COUNT) - 1
bestie I am not touching that one, that's literally how it's written, we do not edit the sacred text π
π METHODS π
Test::Smoke::Patcher->new( $type => \%args );
new() creates the object. Valid types are single and multi. Valid keys for %args:
ddir: the build directoryfdir: 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)regen: flag to set/unset the TRY_REGEN_HEADERS flagv: 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. Lowkey does one job and does it. π«Ά
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 ofpatchdo not grog-u, so be careful! fr fr, read that again.
$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.
and that's the whole page, bestie β perl v5.42.0, dated 2025-07-25, Test::S...Patcher(3), no cap πβ¨ go patch something iconic π
π¦ where this page comes from
- fedora 43: perl-Test-Smoke 1.84-2.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms