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