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
67 Test::Smoke::Patcher->new( $type => \%args );
68 "new()" crates the object. Valid types are single and multi. Valid
69 keys for %args:
70
71 * ddir: the build directory
72 * fdir: the intermediate forest dir (preferred)
73 * pfile: path to either the patch (single) or a textfile (multi)
74 * popts: options to pass to 'patch' (-p1)
75 * patchbin: full path to the patch binary (patch)
76 * v: verbosity 0..2
77
78 Test::Smoke::Patcher->config( $key[, $value] )
79 "config()" is an interface to the package lexical %CONFIG, which
80 holds all the default values for the "new()" arguments.
81
82 With the special key all_defaults this returns a reference to a
83 hash holding all the default values.
84
85 $patcher->patch
86 "patch()" is a simple dispatcher.
87
88 perl_regen_headers( )
89 Try to run regen_headers.pl if the flag is set.
90
91 $patcher->patch_single( )
92 "patch_single()" checks if the pfile attribute is a plain scalar or
93 a ref to a scalar, array, glob. In the first case this is taken to
94 be a filename. A GLOB-ref is a filehandle, the other two are taken
95 to be literal content.
96
97 $patcher->patch_multi( )
98 "patch_multi()" checks the pfile attribute is a plain scalar or a
99 ref to a scalar, array, glob. In the first case this is taken to be
100 a filename. A GLOB-ref is a filehandle, the other two are taken to
101 be literal content.
102
103 $self->_make_opts( $switches )
104 "_make_opts()" just creates a string of options to pass to the
105 patch program. Some implementations of patch do not grog '-u', so
106 be careful!
107
108 $patcher->call_patch( $ref_to_content )
109 "call_patch()" opens a pipe to the patch program and prints
110 $$ref_to_content to it. It will Carp::croak() on any error!
111
113 patch, Test::Smoke::Syncer::Snapshot
114
116 (c) 2002-2003, All rights reserved.
117
118 * Abe Timmerman <abeltje@cpan.org>
119
120 This library is free software; you can redistribute it and/or modify it
121 under the same terms as Perl itself.
122
123 See:
124
125 · http://www.perl.com/perl/misc/Artistic.html
126
127 · http://www.gnu.org/copyleft/gpl.html
128
129 This program is distributed in the hope that it will be useful, but
130 WITHOUT ANY WARRANTY; without even the implied warranty of
131 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
132
133
134
135perl v5.12.1 2008-07-19 Test::Smoke::Patcher(3)