1Dir::Manifest(3) User Contributed Perl Documentation Dir::Manifest(3)
2
3
4
6 Dir::Manifest
7
9 version 0.2.0
10
12 use Dir::Manifest ();
13
14 my $obj = Dir::Manifest->new(
15 {
16 manifest_fn => "./t/data/texts/list.txt",
17 dir => "./t/data/texts/texts",
18 }
19 );
20
21 # TEST
22 is (
23 scalar(`my-process ...`),
24 $obj->text("my-process-output1", {lf => 1,}),
25 "Good output of my-process.",
26 );
27
29 Here is the primary use case: you have several long texts (and/or
30 binary blobs) that you wish to load from the code (e.g: for the
31 "want"/expected values of tests) and you wish to conventiently edit
32 them, track them and maintain them. Using Dir::Manifest you can put
33 each in a separate file in a directory, create a manifest file listing
34 all valid filenames/key and then say something like "my $text =
35 $dir->text("deal24solution.txt", {lf => 1})". And hopefully it will be
36 done securely and reliably.
37
39 Dir::Manifest - treat a directory and a manifest file as a
40 hash/dictionary of keys to texts or blobs
41
43 version 0.2.0
44
46 $self->manifest_fn()
47 The path to the manifest file.
48
49 $self->dir()
50 The path to the directory containing the texts and blobs as files.
51
52 $self->get_keys()
53 Returns a sorted array reference containing the available keys as
54 strings.
55
56 $self->get_obj($key)
57 Returns the Dir::Manifest::Key object associated with the string $key.
58 Throws an error if $key was not given in the manifest.
59
60 $self->fh($key)
61 Returns the Path::Tiny objects for the key, which is usable as a path
62 in string context. Equivalent to "$self->get_obj($key)->fh()".
63
64 (Added in version 0.2.0. ).
65
66 my $contents = $self->text("$key", {%OPTS})
67 Slurps the key using Dir::Manifest::Slurp
68
69 my $hash_ref = $obj->texts_dictionary( {slurp_opts => {},} );
70 Returns a hash reference (a dictionary) containing all keys and their
71 slurped contents as values. 'slurp_opts' is passed to text().
72
74 This code is dedicated to the memory of Jonathan Scott Duff
75 <https://metacpan.org/author/DUFF> a.k.a PerlJam and perlpilot who
76 passed away some days before the first release of this code. For more
77 about him, see:
78
79 · <https://p6weekly.wordpress.com/2018/12/30/2018-53-goodbye-perljam/>
80
81 · <https://www.facebook.com/groups/perl6/permalink/2253332891599724/>
82
83 · <https://www.mail-archive.com/perl6-users@perl.org/msg06390.html>
84
85 · <https://www.shlomifish.org/humour/fortunes/sharp-perl.html>
86
88 kristian vuljar <https://www.jamendo.com/artist/441226/kristian-vuljar>
89 used to have a jamendo track called "Keys" based on Shine 4U
90 <https://www.youtube.com/watch?v=B8ehY5tutHs> by Carmen and Camille.
91 You can find it at
92 <http://www.shlomifish.org/Files/files/dirs/kristian-vuljar--keys/> .
93
95 Websites
96 The following websites have more information about this module, and may
97 be of help to you. As always, in addition to those websites please use
98 your favorite search engine to discover more resources.
99
100 · MetaCPAN
101
102 A modern, open-source CPAN search engine, useful to view POD in
103 HTML format.
104
105 <https://metacpan.org/release/Dir-Manifest>
106
107 · Search CPAN
108
109 The default CPAN search engine, useful to view POD in HTML format.
110
111 <http://search.cpan.org/dist/Dir-Manifest>
112
113 · RT: CPAN's Bug Tracker
114
115 The RT ( Request Tracker ) website is the default bug/issue
116 tracking system for CPAN.
117
118 <https://rt.cpan.org/Public/Dist/Display.html?Name=Dir-Manifest>
119
120 · AnnoCPAN
121
122 The AnnoCPAN is a website that allows community annotations of Perl
123 module documentation.
124
125 <http://annocpan.org/dist/Dir-Manifest>
126
127 · CPAN Ratings
128
129 The CPAN Ratings is a website that allows community ratings and
130 reviews of Perl modules.
131
132 <http://cpanratings.perl.org/d/Dir-Manifest>
133
134 · CPANTS
135
136 The CPANTS is a website that analyzes the Kwalitee ( code metrics )
137 of a distribution.
138
139 <http://cpants.cpanauthors.org/dist/Dir-Manifest>
140
141 · CPAN Testers
142
143 The CPAN Testers is a network of smoke testers who run automated
144 tests on uploaded CPAN distributions.
145
146 <http://www.cpantesters.org/distro/D/Dir-Manifest>
147
148 · CPAN Testers Matrix
149
150 The CPAN Testers Matrix is a website that provides a visual
151 overview of the test results for a distribution on various
152 Perls/platforms.
153
154 <http://matrix.cpantesters.org/?dist=Dir-Manifest>
155
156 · CPAN Testers Dependencies
157
158 The CPAN Testers Dependencies is a website that shows a chart of
159 the test results of all dependencies for a distribution.
160
161 <http://deps.cpantesters.org/?module=Dir::Manifest>
162
163 Bugs / Feature Requests
164 Please report any bugs or feature requests by email to
165 "bug-dir-manifest at rt.cpan.org", or through the web interface at
166 <https://rt.cpan.org/Public/Bug/Report.html?Queue=Dir-Manifest>. You
167 will be automatically notified of any progress on the request by the
168 system.
169
170 Source Code
171 The code is open to the world, and available for you to hack on. Please
172 feel free to browse it and play with it, or whatever. If you want to
173 contribute patches, please send me a diff or prod me to pull from your
174 repository :)
175
176 <https://github.com/shlomif/Dir-Manifest>
177
178 git clone https://github.com/shlomif/Dir-Manifest.git
179
181 Shlomi Fish <shlomif@cpan.org>
182
184 Please report any bugs or feature requests on the bugtracker website
185 <https://github.com/shlomif/dir-manifest/issues>
186
187 When submitting a bug or request, please include a test-file or a patch
188 to an existing test-file that illustrates the bug or desired feature.
189
191 This software is Copyright (c) 2019 by Shlomi Fish.
192
193 This is free software, licensed under:
194
195 The MIT (X11) License
196
197
198
199perl v5.30.0 2019-07-26 Dir::Manifest(3)