1Module::Manifest(3) User Contributed Perl Documentation Module::Manifest(3)
2
3
4
6 Module::Manifest - Parse and examine a Perl distribution MANIFEST file
7
9 version 1.09
10
12 Open and parse a MANIFEST and MANIFEST.SKIP:
13
14 my $manifest = Module::Manifest->new( 'MANIFEST', 'MANIFEST.SKIP' );
15
16 Check if a given file matches any known skip masks:
17
18 print "yes\n" if $manifest->skipped('.svn');
19
21 Module::Manifest is a simple utility module created originally for use
22 in Module::Inspector.
23
24 It can load a MANIFEST file that comes in a Perl distribution tarball,
25 examine the contents, and perform some simple tasks. It can also load
26 the MANIFEST.SKIP file and check that.
27
28 Granted, the functionality needed to do this is quite simple, but the
29 Perl distribution MANIFEST specification contains a couple of little
30 idiosyncracies, such as line comments and space-seperated inline
31 comments.
32
33 The use of this module means that any little nigglies are dealt with
34 behind the scenes, and you can concentrate the main task at hand.
35
36 Comparison to ExtUtil::Manifest
37 This module is quite similar to ExtUtils::Manifest, or is at least
38 similar in scope. However, there is a general difference in approach.
39
40 ExtUtils::Manifest is imperative, requires the existance of the actual
41 MANIFEST file on disk, and requires that your current directory remains
42 the same.
43
44 Module::Manifest treats the MANIFEST file as an object, can load a the
45 file from anywhere on disk, and can run some of the same functionality
46 without having to change your current directory context.
47
48 That said, note that Module::Manifest is aimed at reading and checking
49 existing MANFIFEST files, rather than creating new ones.
50
52 This module should be compatible with Perl 5.005 and above. However, it
53 has only been rigorously tested under Perl 5.10.0 on Linux.
54
55 If you encounter any problems on a different version or architecture,
56 please contact the maintainer.
57
59 new
60 Module::Manifest->new( $manifest, $skip )
61
62 Creates a "Module::Manifest" object, which either parses the files
63 referenced by the $manifest (for MANIFEST) and $skip (for
64 MANIFEST.SKIP). If no parameters are specified, it creates an empty
65 object.
66
67 Example code:
68
69 my $manifest = Module::Manifest->new;
70 my $manifest = Module::Manifest->new( $manifest );
71 my $manifest = Module::Manifest->new( $manifest, $skip );
72
73 This method will return an appropriate Module::Manifest object or
74 throws an exception on error.
75
76 open
77 $manifest->open( $type => $filename )
78
79 Open and parse the file given by $filename, which may be a relative
80 path. The available $type options are either: 'skip' or 'manifest'
81
82 Example code:
83
84 $manifest->open( skip => 'MANIFEST.SKIP' );
85 $manifest->open( manifest => 'MANIFEST' );
86
87 This method doesn't return anything, but may throw an exception on
88 error.
89
90 parse
91 $manifest->parse( $type => \@files )
92
93 Parse "\@files", which is an array reference containing a list of files
94 or regular expression masks. The available $type options are either:
95 'skip' or 'manifest'
96
97 Example code:
98
99 $manifest->parse( skip => [
100 '\B\.svn\b',
101 '^Build$',
102 '\bMakefile$',
103 ]);
104
105 This method doesn't return anything, but may throw an exception on
106 error.
107
108 skipped
109 $manifest->skipped( $filename )
110
111 Check if $filename matches any masks that should be skipped, given the
112 regular expressions provided to either the "parse" or "open" methods.
113
114 Absolute path names must first be relativized and converted to a Unix-
115 like path string by using the "normalize" method.
116
117 Example code:
118
119 if ($manifest->skipped('Makefile.PL')) {
120 # do stuff
121 }
122
123 This method returns a boolean true or false value indicating whether
124 the file path is skipped according the "skipfile".
125
126 normalize
127 Module::Manifest->normalize( $path, $rel )
128 $manifest->normalize( $path, $rel )
129
130 This method takes a given platform-specific path string and converts it
131 to a Unix-style string compatible with the MANIFEST and MANIFEST.SKIP
132 specifications.
133
134 Note that this method normalizes paths depending on the platform
135 detected by $^O -- that is, Win32 style paths can only be normalized if
136 the module is currently running under Win32.
137
138 By default, this method will relativize file paths to the current
139 working directory (using File::Spec's "abs2rel" method without a
140 $root). To disable this behaviour, set $rel to a false value.
141
142 Example code:
143
144 # Useful for normalizing Win32-style paths
145 my $normal = Module::Manifest->normalize('t\\test\\file');
146 # Returns: t/test/file (ie, in Unix style for MANIFEST)
147
148 This returns a normalized version of the given path.
149
150 file
151 $manifest->file
152
153 The "file" accessor returns the absolute path of the MANIFEST file that
154 was loaded.
155
156 skipfile
157 $manifest->skipfile
158
159 The "skipfile" accessor returns the absolute path of the MANIFEST.SKIP
160 file that was loaded.
161
162 dir
163 $manifest->dir
164
165 The "dir" accessor returns the path to the directory that contains the
166 MANIFEST or skip file, and thus SHOULD be the root of the distribution.
167
168 files
169 $manifest->files
170
171 The "files" method returns the (relative, unix-style) list of files
172 within the manifest. In scalar context, returns the number of files in
173 the manifest.
174
175 Example code:
176
177 my @files = $manifest->files;
178
180 The directory returned by the "dir" method is overwritten whenever
181 "open" is called. This means that, if MANIFEST and MANIFEST.SKIP are
182 not in the same directory, the module may get a bit confused.
183
185 This module is stored in an Open Repository at the following address:
186
187 <http://svn.ali.as/cpan/trunk/Module-Manifest>
188
189 Write access to the repository is made available automatically to any
190 published CPAN author, and to most other volunteers on request.
191
192 If you are able to submit your bug report in the form of new (failing)
193 unit tests, or can apply your fix directly instead of submitting a
194 patch, you are strongly encouraged to do so. The author currently
195 maintains over 100 modules and it may take some time to deal with non-
196 critical bug reports or patches.
197
198 This will guarantee that your issue will be addressed in the next
199 release of the module.
200
201 If you cannot provide a direct test or fix, or don't have time to do
202 so, then regular bug reports are still accepted and appreciated via the
203 CPAN bug tracker.
204
205 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Module-Manifest>
206
207 For other issues, for commercial enhancement and support, or to have
208 your write access enabled for the repository, contact the author at the
209 email address above.
210
212 Adam Kennedy <adamk@cpan.org>
213
214 CONTIRBUTORS
215 Jonathan Yu <jawnsy@cpan.org>
216
218 ExtUtils::Manifest
219
221 Copyright 2006 - 2010 Adam Kennedy
222
223 This program is free software; you can redistribute it and/or modify it
224 under the same terms as Perl itself.
225
226 The full text of the license can be found in the LICENSE file included
227 with this module.
228
229
230
231perl v5.32.0 2020-07-28 Module::Manifest(3)