Test::S...Patcher(3)

πŸ“¦
version 1.84 Β· 2 versions
, in fedora 43

πŸŽ€ 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 ddir attribute).

🌸 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 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)
  • regen: flag to set/unset the TRY_REGEN_HEADERS flag
  • 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. 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 of patch do 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


(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