1Test::Smoke::Patcher(3)User Contributed Perl DocumentatioTnest::Smoke::Patcher(3)
2
3
4
6 Test::Smoke::Patcher - OO interface to help patching the source-tree
7
9 use Test::Smoke::Patcher;
10
11 my $patcher = Test::Smoke::Patcher->new( single => {
12 ddir => $build_dir,
13 pfile => $patch,
14 popts => '-p1',
15 v => 1, # 0..2
16 });
17 $patcher->patch;
18
19 or
20
21 my $patcher = Test::Smoke::Patcher->new( multi => {
22 ddir => $buildir,
23 pfile => $patch_info,
24 v => 1, #0..2
25 });
26 $patcher->patch;
27
29 Okay, you will need a working patch program, which I believe is
30 available for most platforms perl runs on.
31
32 There are two ways to initialise the Test::Smoke::Patcher object.
33
34 single mode
35 The pfile attribute is a pointer to a single patch. There are four
36 (4) ways to specify that patch.
37
38 refernece to a SCALAR
39 The scalar holds the complete patch as literal text.
40
41 reference to an ARRAY
42 The array holds a list of lines (with newlines) that make up
43 the patch as literal text ("$patch = join "", @$array_ref").
44
45 reference to a GLOB
46 You passed an opened filehandle to a file containing the patch.
47
48 filename
49 If none of the above apply, it is assumed you passed a
50 filename. Relative paths are rooted at the builddir (ddir
51 attribute).
52
53 multi mode
54 The pfile attribute is a pointer to a recource that contains
55 filenames of patches. The format of this recource is one filename
56 per line optionally followed by a semi-colon (;) and switches for
57 the patch program.
58
59 The patch-resource can also be specified in four (4) ways.
60
61 reference to a SCALAR
62 reference to an ARRAY
63 reference to a GLOB
64 filename
65
66 TRY_REGEN_HEADERS
67 Constant: 1
68
69 MAX_FLAG_COUNT
70 Constant: 16
71
72 ALL_FLAGS
73 Constant: 2**MAX_FLAG_COUNT) - 1
74
76 Test::Smoke::Patcher->new( $type => \%args );
77 "new()" crates the object. Valid types are single and multi. Valid
78 keys for %args:
79
80 * ddir: the build directory
81 * fdir: the intermediate forest dir (preferred)
82 * pfile: path to either the patch (single) or a textfile (multi)
83 * popts: options to pass to 'patch' (-p1)
84 * patchbin: full path to the patch binary (patch)
85 * regen: flag to set/unset the TRY_REGEN_HEADERS flag
86 * v: verbosity 0..2
87
88 Test::Smoke::Patcher->config( $key[, $value] )
89 "config()" is an interface to the package lexical %CONFIG, which
90 holds all the default values for the "new()" arguments.
91
92 With the special key all_defaults this returns a reference to a
93 hash holding all the default values.
94
95 $patcher->patch
96 "patch()" is a simple dispatcher.
97
98 perl_regen_headers( )
99 Try to run regen_headers.pl if the flag is set.
100
101 $patcher->patch_single( )
102 "patch_single()" checks if the pfile attribute is a plain scalar or
103 a ref to a scalar, array, glob. In the first case this is taken to
104 be a filename. A GLOB-ref is a filehandle, the other two are taken
105 to be literal content.
106
107 $patcher->patch_multi( )
108 "patch_multi()" checks the pfile attribute is a plain scalar or a
109 ref to a scalar, array, glob. In the first case this is taken to be
110 a filename. A GLOB-ref is a filehandle, the other two are taken to
111 be literal content.
112
113 $self->_make_opts( $switches )
114 "_make_opts()" just creates a string of options to pass to the
115 patch program. Some implementations of patch do not grog '-u', so
116 be careful!
117
118 $patcher->call_patch( $ref_to_content )
119 "call_patch()" opens a pipe to the patch program and prints
120 $$ref_to_content to it. It will Carp::croak() on any error!
121
123 patch, Test::Smoke::Syncer::Snapshot
124
126 (c) 2002-2003, All rights reserved.
127
128 * Abe Timmerman <abeltje@cpan.org>
129
130 This library is free software; you can redistribute it and/or modify it
131 under the same terms as Perl itself.
132
133 See:
134
135 · http://www.perl.com/perl/misc/Artistic.html
136
137 · http://www.gnu.org/copyleft/gpl.html
138
139 This program is distributed in the hope that it will be useful, but
140 WITHOUT ANY WARRANTY; without even the implied warranty of
141 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
142
143
144
145perl v5.32.0 2020-07-28 Test::Smoke::Patcher(3)