Codebase list libfile-basedir-perl / f6ef6a03-3906-4f17-bbc6-c6050a42a5a9/upstream
Import upstream version 0.09 Debian Janitor 2 years ago
35 changed file(s) with 1843 addition(s) and 478 deletion(s). Raw diff Collapse all Expand all
+0
-27
Build.PL less more
0 #!/usr/bin/perl
1
2 use Module::Build;
3
4 my $build = Module::Build->new(
5 dist_name => 'File-BaseDir',
6 dist_version_from => 'lib/File/BaseDir.pm',
7 dist_author => 'Jaap Karssenberg <pardus@cpan.org>',
8 license => 'perl',
9 requires => {
10 'Carp' => 0,
11 'Exporter' => 0,
12 'File::Spec' => 0,
13 'IPC::System::Simple' => 0
14 },
15 build_requires => {
16 'Module::Build' => '0.24',
17 'Test::More' => 0,
18 'File::Which' => 0,
19 'File::Temp' => 0
20
21 },
22 create_makefile_pl => 'small',
23 );
24
25 $build->create_build_script;
26
0 Revision history for Perl extension File::BaseDir.
0 Revision history for File-BaseDir
1
2 0.09 2021-07-08 14:04:14 -0600
3 - Tests can now be run in parallel or isolation safely (rt#199256)
4 - Fallback on getpwuid if environment variable not set (rt#127138)
5 - Test suite works with or without environment variables (rt#127138)
16
27 0.08 13 Mar 2018
38 Fix for failing test in 03_userdirs.t, thanks to Pierre Labastie
0 This is the Perl distribution File-BaseDir.
1
2 Installing File-BaseDir is straightforward.
3
4 ## Installation with cpanm
5
6 If you have cpanm, you only need one line:
7
8 % cpanm File::BaseDir
9
10 If it does not have permission to install modules to the current perl, cpanm
11 will automatically set up and install to a local::lib in your home directory.
12 See the local::lib documentation (https://metacpan.org/pod/local::lib) for
13 details on enabling it in your environment.
14
15 ## Installing with the CPAN shell
16
17 Alternatively, if your CPAN shell is set up, you should just be able to do:
18
19 % cpan File::BaseDir
20
21 ## Manual installation
22
23 As a last resort, you can manually install it. If you have not already
24 downloaded the release tarball, you can find the download link on the module's
25 MetaCPAN page: https://metacpan.org/pod/File::BaseDir
26
27 Untar the tarball, install configure prerequisites (see below), then build it:
28
29 % perl Makefile.PL
30 % make && make test
31
32 Then install it:
33
34 % make install
35
36 On Windows platforms, you should use `dmake` or `nmake`, instead of `make`.
37
38 If your perl is system-managed, you can create a local::lib in your home
39 directory to install modules to. For details, see the local::lib documentation:
40 https://metacpan.org/pod/local::lib
41
42 The prerequisites of this distribution will also have to be installed manually. The
43 prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated
44 by running the manual build process described above.
45
46 ## Configure Prerequisites
47
48 This distribution requires other modules to be installed before this
49 distribution's installer can be run. They can be found under the
50 "configure_requires" key of META.yml or the
51 "{prereqs}{configure}{requires}" key of META.json.
52
53 ## Other Prerequisites
54
55 This distribution may require additional modules to be installed after running
56 Makefile.PL.
57 Look for prerequisites in the following phases:
58
59 * to run make, PHASE = build
60 * to use the module code itself, PHASE = runtime
61 * to run tests, PHASE = test
62
63 They can all be found in the "PHASE_requires" key of MYMETA.yml or the
64 "{prereqs}{PHASE}{requires}" key of MYMETA.json.
65
66 ## Documentation
67
68 File-BaseDir documentation is available as POD.
69 You can run `perldoc` from a shell to read the documentation:
70
71 % perldoc File::BaseDir
72
73 For more information on installing Perl modules via CPAN, please see:
74 https://www.cpan.org/modules/INSTALL.html
0 This software is copyright (c) 2003-2021 by Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>.
1
2 This is free software; you can redistribute it and/or modify it under
3 the same terms as the Perl 5 programming language system itself.
4
5 Terms of the Perl programming language system itself
6
7 a) the GNU General Public License as published by the Free
8 Software Foundation; either version 1, or (at your option) any
9 later version, or
10 b) the "Artistic License"
11
12 --- The GNU General Public License, Version 1, February 1989 ---
13
14 This software is Copyright (c) 2003-2021 by Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>.
15
16 This is free software, licensed under:
17
18 The GNU General Public License, Version 1, February 1989
19
20 GNU GENERAL PUBLIC LICENSE
21 Version 1, February 1989
22
23 Copyright (C) 1989 Free Software Foundation, Inc.
24 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26 Everyone is permitted to copy and distribute verbatim copies
27 of this license document, but changing it is not allowed.
28
29 Preamble
30
31 The license agreements of most software companies try to keep users
32 at the mercy of those companies. By contrast, our General Public
33 License is intended to guarantee your freedom to share and change free
34 software--to make sure the software is free for all its users. The
35 General Public License applies to the Free Software Foundation's
36 software and to any other program whose authors commit to using it.
37 You can use it for your programs, too.
38
39 When we speak of free software, we are referring to freedom, not
40 price. Specifically, the General Public License is designed to make
41 sure that you have the freedom to give away or sell copies of free
42 software, that you receive source code or can get it if you want it,
43 that you can change the software or use pieces of it in new free
44 programs; and that you know you can do these things.
45
46 To protect your rights, we need to make restrictions that forbid
47 anyone to deny you these rights or to ask you to surrender the rights.
48 These restrictions translate to certain responsibilities for you if you
49 distribute copies of the software, or if you modify it.
50
51 For example, if you distribute copies of a such a program, whether
52 gratis or for a fee, you must give the recipients all the rights that
53 you have. You must make sure that they, too, receive or can get the
54 source code. And you must tell them their rights.
55
56 We protect your rights with two steps: (1) copyright the software, and
57 (2) offer you this license which gives you legal permission to copy,
58 distribute and/or modify the software.
59
60 Also, for each author's protection and ours, we want to make certain
61 that everyone understands that there is no warranty for this free
62 software. If the software is modified by someone else and passed on, we
63 want its recipients to know that what they have is not the original, so
64 that any problems introduced by others will not reflect on the original
65 authors' reputations.
66
67 The precise terms and conditions for copying, distribution and
68 modification follow.
69
70 GNU GENERAL PUBLIC LICENSE
71 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
72
73 0. This License Agreement applies to any program or other work which
74 contains a notice placed by the copyright holder saying it may be
75 distributed under the terms of this General Public License. The
76 "Program", below, refers to any such program or work, and a "work based
77 on the Program" means either the Program or any work containing the
78 Program or a portion of it, either verbatim or with modifications. Each
79 licensee is addressed as "you".
80
81 1. You may copy and distribute verbatim copies of the Program's source
82 code as you receive it, in any medium, provided that you conspicuously and
83 appropriately publish on each copy an appropriate copyright notice and
84 disclaimer of warranty; keep intact all the notices that refer to this
85 General Public License and to the absence of any warranty; and give any
86 other recipients of the Program a copy of this General Public License
87 along with the Program. You may charge a fee for the physical act of
88 transferring a copy.
89
90 2. You may modify your copy or copies of the Program or any portion of
91 it, and copy and distribute such modifications under the terms of Paragraph
92 1 above, provided that you also do the following:
93
94 a) cause the modified files to carry prominent notices stating that
95 you changed the files and the date of any change; and
96
97 b) cause the whole of any work that you distribute or publish, that
98 in whole or in part contains the Program or any part thereof, either
99 with or without modifications, to be licensed at no charge to all
100 third parties under the terms of this General Public License (except
101 that you may choose to grant warranty protection to some or all
102 third parties, at your option).
103
104 c) If the modified program normally reads commands interactively when
105 run, you must cause it, when started running for such interactive use
106 in the simplest and most usual way, to print or display an
107 announcement including an appropriate copyright notice and a notice
108 that there is no warranty (or else, saying that you provide a
109 warranty) and that users may redistribute the program under these
110 conditions, and telling the user how to view a copy of this General
111 Public License.
112
113 d) You may charge a fee for the physical act of transferring a
114 copy, and you may at your option offer warranty protection in
115 exchange for a fee.
116
117 Mere aggregation of another independent work with the Program (or its
118 derivative) on a volume of a storage or distribution medium does not bring
119 the other work under the scope of these terms.
120
121 3. You may copy and distribute the Program (or a portion or derivative of
122 it, under Paragraph 2) in object code or executable form under the terms of
123 Paragraphs 1 and 2 above provided that you also do one of the following:
124
125 a) accompany it with the complete corresponding machine-readable
126 source code, which must be distributed under the terms of
127 Paragraphs 1 and 2 above; or,
128
129 b) accompany it with a written offer, valid for at least three
130 years, to give any third party free (except for a nominal charge
131 for the cost of distribution) a complete machine-readable copy of the
132 corresponding source code, to be distributed under the terms of
133 Paragraphs 1 and 2 above; or,
134
135 c) accompany it with the information you received as to where the
136 corresponding source code may be obtained. (This alternative is
137 allowed only for noncommercial distribution and only if you
138 received the program in object code or executable form alone.)
139
140 Source code for a work means the preferred form of the work for making
141 modifications to it. For an executable file, complete source code means
142 all the source code for all modules it contains; but, as a special
143 exception, it need not include source code for modules which are standard
144 libraries that accompany the operating system on which the executable
145 file runs, or for standard header files or definitions files that
146 accompany that operating system.
147
148 4. You may not copy, modify, sublicense, distribute or transfer the
149 Program except as expressly provided under this General Public License.
150 Any attempt otherwise to copy, modify, sublicense, distribute or transfer
151 the Program is void, and will automatically terminate your rights to use
152 the Program under this License. However, parties who have received
153 copies, or rights to use copies, from you under this General Public
154 License will not have their licenses terminated so long as such parties
155 remain in full compliance.
156
157 5. By copying, distributing or modifying the Program (or any work based
158 on the Program) you indicate your acceptance of this license to do so,
159 and all its terms and conditions.
160
161 6. Each time you redistribute the Program (or any work based on the
162 Program), the recipient automatically receives a license from the original
163 licensor to copy, distribute or modify the Program subject to these
164 terms and conditions. You may not impose any further restrictions on the
165 recipients' exercise of the rights granted herein.
166
167 7. The Free Software Foundation may publish revised and/or new versions
168 of the General Public License from time to time. Such new versions will
169 be similar in spirit to the present version, but may differ in detail to
170 address new problems or concerns.
171
172 Each version is given a distinguishing version number. If the Program
173 specifies a version number of the license which applies to it and "any
174 later version", you have the option of following the terms and conditions
175 either of that version or of any later version published by the Free
176 Software Foundation. If the Program does not specify a version number of
177 the license, you may choose any version ever published by the Free Software
178 Foundation.
179
180 8. If you wish to incorporate parts of the Program into other free
181 programs whose distribution conditions are different, write to the author
182 to ask for permission. For software which is copyrighted by the Free
183 Software Foundation, write to the Free Software Foundation; we sometimes
184 make exceptions for this. Our decision will be guided by the two goals
185 of preserving the free status of all derivatives of our free software and
186 of promoting the sharing and reuse of software generally.
187
188 NO WARRANTY
189
190 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
191 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
192 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
193 PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
194 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
195 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
196 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
197 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
198 REPAIR OR CORRECTION.
199
200 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
201 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
202 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
203 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
204 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
205 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
206 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
207 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
208 POSSIBILITY OF SUCH DAMAGES.
209
210 END OF TERMS AND CONDITIONS
211
212 Appendix: How to Apply These Terms to Your New Programs
213
214 If you develop a new program, and you want it to be of the greatest
215 possible use to humanity, the best way to achieve this is to make it
216 free software which everyone can redistribute and change under these
217 terms.
218
219 To do so, attach the following notices to the program. It is safest to
220 attach them to the start of each source file to most effectively convey
221 the exclusion of warranty; and each file should have at least the
222 "copyright" line and a pointer to where the full notice is found.
223
224 <one line to give the program's name and a brief idea of what it does.>
225 Copyright (C) 19yy <name of author>
226
227 This program is free software; you can redistribute it and/or modify
228 it under the terms of the GNU General Public License as published by
229 the Free Software Foundation; either version 1, or (at your option)
230 any later version.
231
232 This program is distributed in the hope that it will be useful,
233 but WITHOUT ANY WARRANTY; without even the implied warranty of
234 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
235 GNU General Public License for more details.
236
237 You should have received a copy of the GNU General Public License
238 along with this program; if not, write to the Free Software
239 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
240
241
242 Also add information on how to contact you by electronic and paper mail.
243
244 If the program is interactive, make it output a short notice like this
245 when it starts in an interactive mode:
246
247 Gnomovision version 69, Copyright (C) 19xx name of author
248 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
249 This is free software, and you are welcome to redistribute it
250 under certain conditions; type `show c' for details.
251
252 The hypothetical commands `show w' and `show c' should show the
253 appropriate parts of the General Public License. Of course, the
254 commands you use may be called something other than `show w' and `show
255 c'; they could even be mouse-clicks or menu items--whatever suits your
256 program.
257
258 You should also get your employer (if you work as a programmer) or your
259 school, if any, to sign a "copyright disclaimer" for the program, if
260 necessary. Here a sample; alter the names:
261
262 Yoyodyne, Inc., hereby disclaims all copyright interest in the
263 program `Gnomovision' (a program to direct compilers to make passes
264 at assemblers) written by James Hacker.
265
266 <signature of Ty Coon>, 1 April 1989
267 Ty Coon, President of Vice
268
269 That's all there is to it!
270
271
272 --- The Artistic License 1.0 ---
273
274 This software is Copyright (c) 2003-2021 by Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>.
275
276 This is free software, licensed under:
277
278 The Artistic License 1.0
279
280 The Artistic License
281
282 Preamble
283
284 The intent of this document is to state the conditions under which a Package
285 may be copied, such that the Copyright Holder maintains some semblance of
286 artistic control over the development of the package, while giving the users of
287 the package the right to use and distribute the Package in a more-or-less
288 customary fashion, plus the right to make reasonable modifications.
289
290 Definitions:
291
292 - "Package" refers to the collection of files distributed by the Copyright
293 Holder, and derivatives of that collection of files created through
294 textual modification.
295 - "Standard Version" refers to such a Package if it has not been modified,
296 or has been modified in accordance with the wishes of the Copyright
297 Holder.
298 - "Copyright Holder" is whoever is named in the copyright or copyrights for
299 the package.
300 - "You" is you, if you're thinking about copying or distributing this Package.
301 - "Reasonable copying fee" is whatever you can justify on the basis of media
302 cost, duplication charges, time of people involved, and so on. (You will
303 not be required to justify it to the Copyright Holder, but only to the
304 computing community at large as a market that must bear the fee.)
305 - "Freely Available" means that no fee is charged for the item itself, though
306 there may be fees involved in handling the item. It also means that
307 recipients of the item may redistribute it under the same conditions they
308 received it.
309
310 1. You may make and give away verbatim copies of the source form of the
311 Standard Version of this Package without restriction, provided that you
312 duplicate all of the original copyright notices and associated disclaimers.
313
314 2. You may apply bug fixes, portability fixes and other modifications derived
315 from the Public Domain or from the Copyright Holder. A Package modified in such
316 a way shall still be considered the Standard Version.
317
318 3. You may otherwise modify your copy of this Package in any way, provided that
319 you insert a prominent notice in each changed file stating how and when you
320 changed that file, and provided that you do at least ONE of the following:
321
322 a) place your modifications in the Public Domain or otherwise make them
323 Freely Available, such as by posting said modifications to Usenet or an
324 equivalent medium, or placing the modifications on a major archive site
325 such as ftp.uu.net, or by allowing the Copyright Holder to include your
326 modifications in the Standard Version of the Package.
327
328 b) use the modified Package only within your corporation or organization.
329
330 c) rename any non-standard executables so the names do not conflict with
331 standard executables, which must also be provided, and provide a separate
332 manual page for each non-standard executable that clearly documents how it
333 differs from the Standard Version.
334
335 d) make other distribution arrangements with the Copyright Holder.
336
337 4. You may distribute the programs of this Package in object code or executable
338 form, provided that you do at least ONE of the following:
339
340 a) distribute a Standard Version of the executables and library files,
341 together with instructions (in the manual page or equivalent) on where to
342 get the Standard Version.
343
344 b) accompany the distribution with the machine-readable source of the Package
345 with your modifications.
346
347 c) accompany any non-standard executables with their corresponding Standard
348 Version executables, giving the non-standard executables non-standard
349 names, and clearly documenting the differences in manual pages (or
350 equivalent), together with instructions on where to get the Standard
351 Version.
352
353 d) make other distribution arrangements with the Copyright Holder.
354
355 5. You may charge a reasonable copying fee for any distribution of this
356 Package. You may charge any fee you choose for support of this Package. You
357 may not charge a fee for this Package itself. However, you may distribute this
358 Package in aggregate with other (possibly commercial) programs as part of a
359 larger (possibly commercial) software distribution provided that you do not
360 advertise this Package as a product of your own.
361
362 6. The scripts and library files supplied as input to or produced as output
363 from the programs of this Package do not automatically fall under the copyright
364 of this Package, but belong to whomever generated them, and may be sold
365 commercially, and may be aggregated with this Package.
366
367 7. C or perl subroutines supplied by you and linked into this Package shall not
368 be considered part of this Package.
369
370 8. The name of the Copyright Holder may not be used to endorse or promote
371 products derived from this software without specific prior written permission.
372
373 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
374 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
375 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
376
377 The End
378
0 Build.PL
0 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.022.
11 Changes
2 configure
2 INSTALL
3 LICENSE
4 MANIFEST
5 META.json
6 META.yml
7 Makefile.PL
8 README
9 author.yml
10 dist.ini
311 lib/File/BaseDir.pm
412 lib/File/IconTheme.pm
513 lib/File/UserDirs.pm
6 Makefile.PL
7 MANIFEST This list of files
8 META.yml
9 README
14 perlcriticrc
15 t/00_diag.t
1016 t/01_vars.t
1117 t/02_lookup.t
1218 t/03_OO.t
1319 t/03_icontheme.t
1420 t/03_userdirs.t
15 t/04_pod_ok.t
16 t/05_pod_cover.t
17 META.json
21 t/lib/Helper.pm
22 xt/author/critic.t
23 xt/author/eol.t
24 xt/author/no_tabs.t
25 xt/author/pod.t
26 xt/author/pod_coverage.t
27 xt/author/pod_spelling_common.t
28 xt/author/pod_spelling_system.t
29 xt/author/strict.t
30 xt/author/version.t
31 xt/release/fixme.t
0 {
1 "abstract" : "Use the Freedesktop.org base directory specification",
2 "author" : [
3 "Jaap Karssenberg <pardus@cpan.org>"
4 ],
5 "dynamic_config" : 1,
6 "generated_by" : "Module::Build version 0.4208",
7 "license" : [
8 "perl_5"
9 ],
10 "meta-spec" : {
11 "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
12 "version" : "2"
13 },
14 "name" : "File-BaseDir",
15 "prereqs" : {
16 "build" : {
17 "requires" : {
18 "File::Temp" : "0",
19 "File::Which" : "0",
20 "Module::Build" : "0.24",
21 "Test::More" : "0"
22 }
23 },
24 "configure" : {
25 "requires" : {
26 "Module::Build" : "0.42"
27 }
28 },
29 "runtime" : {
30 "requires" : {
31 "Carp" : "0",
32 "Exporter" : "0",
33 "File::Spec" : "0",
34 "IPC::System::Simple" : "0"
35 }
36 }
37 },
38 "provides" : {
39 "File::BaseDir" : {
40 "file" : "lib/File/BaseDir.pm",
41 "version" : "0.08"
42 },
43 "File::IconTheme" : {
44 "file" : "lib/File/IconTheme.pm",
45 "version" : "0.08"
46 },
47 "File::UserDirs" : {
48 "file" : "lib/File/UserDirs.pm",
49 "version" : "0.08"
50 }
51 },
52 "release_status" : "stable",
53 "resources" : {
54 "license" : [
55 "http://dev.perl.org/licenses/"
56 ]
57 },
58 "version" : "0.08",
59 "x_serialization_backend" : "JSON::PP version 2.27300"
60 }
0 {
1 "abstract" : "Use the Freedesktop.org base directory specification",
2 "author" : [
3 "Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>",
4 "Graham Ollis <plicease@cpan.org>"
5 ],
6 "dynamic_config" : 0,
7 "generated_by" : "Dist::Zilla version 6.022, CPAN::Meta::Converter version 2.150010",
8 "license" : [
9 "perl_5"
10 ],
11 "meta-spec" : {
12 "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
13 "version" : 2
14 },
15 "name" : "File-BaseDir",
16 "prereqs" : {
17 "configure" : {
18 "requires" : {
19 "ExtUtils::MakeMaker" : "0",
20 "perl" : "5.006"
21 }
22 },
23 "develop" : {
24 "requires" : {
25 "FindBin" : "0",
26 "Perl::Critic" : "0",
27 "Test2::Require::Module" : "0.000121",
28 "Test2::Tools::PerlCritic" : "0",
29 "Test2::V0" : "0.000121",
30 "Test::EOL" : "0",
31 "Test::Fixme" : "0.07",
32 "Test::More" : "0.98",
33 "Test::NoTabs" : "0",
34 "Test::Pod" : "0",
35 "Test::Pod::Coverage" : "0",
36 "Test::Pod::Spelling::CommonMistakes" : "0",
37 "Test::Spelling" : "0",
38 "Test::Strict" : "0",
39 "YAML" : "0"
40 }
41 },
42 "runtime" : {
43 "requires" : {
44 "Exporter" : "5.57",
45 "IPC::System::Simple" : "0",
46 "perl" : "5.006"
47 }
48 },
49 "test" : {
50 "requires" : {
51 "File::Which" : "0",
52 "Test::More" : "0.98",
53 "perl" : "5.006"
54 }
55 }
56 },
57 "release_status" : "stable",
58 "resources" : {
59 "bugtracker" : {
60 "web" : "https://github.com/uperl/File-BaseDir/issues"
61 },
62 "homepage" : "https://metacpan.org/pod/File::BaseDir",
63 "repository" : {
64 "type" : "git",
65 "url" : "git://github.com/uperl/File-BaseDir.git",
66 "web" : "https://github.com/uperl/File-BaseDir"
67 }
68 },
69 "version" : "0.09",
70 "x_generated_by_perl" : "v5.34.0",
71 "x_serialization_backend" : "Cpanel::JSON::XS version 4.26",
72 "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later",
73 "x_use_unsafe_inc" : 0
74 }
75
0 ---
1 abstract: 'Use the Freedesktop.org base directory specification'
2 author:
3 - 'Jaap Karssenberg <pardus@cpan.org>'
4 build_requires:
5 File::Temp: '0'
6 File::Which: '0'
7 Module::Build: '0.24'
8 Test::More: '0'
9 configure_requires:
10 Module::Build: '0.42'
11 dynamic_config: 1
12 generated_by: 'Module::Build version 0.4208, CPAN::Meta::Converter version 2.150005'
13 license: perl
14 meta-spec:
15 url: http://module-build.sourceforge.net/META-spec-v1.4.html
16 version: '1.4'
17 name: File-BaseDir
18 provides:
19 File::BaseDir:
20 file: lib/File/BaseDir.pm
21 version: '0.08'
22 File::IconTheme:
23 file: lib/File/IconTheme.pm
24 version: '0.08'
25 File::UserDirs:
26 file: lib/File/UserDirs.pm
27 version: '0.08'
28 requires:
29 Carp: '0'
30 Exporter: '0'
31 File::Spec: '0'
32 IPC::System::Simple: '0'
33 resources:
34 license: http://dev.perl.org/licenses/
35 version: '0.08'
36 x_serialization_backend: 'CPAN::Meta::YAML version 0.016'
0 ---
1 abstract: 'Use the Freedesktop.org base directory specification'
2 author:
3 - 'Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>'
4 - 'Graham Ollis <plicease@cpan.org>'
5 build_requires:
6 File::Which: '0'
7 Test::More: '0.98'
8 perl: '5.006'
9 configure_requires:
10 ExtUtils::MakeMaker: '0'
11 perl: '5.006'
12 dynamic_config: 0
13 generated_by: 'Dist::Zilla version 6.022, CPAN::Meta::Converter version 2.150010'
14 license: perl
15 meta-spec:
16 url: http://module-build.sourceforge.net/META-spec-v1.4.html
17 version: '1.4'
18 name: File-BaseDir
19 requires:
20 Exporter: '5.57'
21 IPC::System::Simple: '0'
22 perl: '5.006'
23 resources:
24 bugtracker: https://github.com/uperl/File-BaseDir/issues
25 homepage: https://metacpan.org/pod/File::BaseDir
26 repository: git://github.com/uperl/File-BaseDir.git
27 version: '0.09'
28 x_generated_by_perl: v5.34.0
29 x_serialization_backend: 'YAML::Tiny version 1.73'
30 x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later'
31 x_use_unsafe_inc: 0
0 # Note: this file was auto-generated by Module::Build::Compat version 0.4208
1 use Module::Build::Compat 0.02;
2
3 Module::Build::Compat->run_build_pl(args => \@ARGV);
4 require Module::Build;
5 Module::Build::Compat->write_makefile(build_class => 'Module::Build');
0 BEGIN {
1 use strict; use warnings;
2 unless(eval q{ use 5.006; 1}) {
3 print "Perl 5.006 or better required\n";
4 exit;
5 }
6 }
7 # This file was automatically generated by Dist::Zilla::Plugin::Author::Plicease::MakeMaker v2.66.
8 use strict;
9 use warnings;
10 use 5.006;
11 use ExtUtils::MakeMaker;
12
13 my %WriteMakefileArgs = (
14 "ABSTRACT" => "Use the Freedesktop.org base directory specification",
15 "AUTHOR" => "Jaap Karssenberg || Pardus [Larus] <pardus\@cpan.org>, Graham Ollis <plicease\@cpan.org>",
16 "CONFIGURE_REQUIRES" => {
17 "ExtUtils::MakeMaker" => 0
18 },
19 "DISTNAME" => "File-BaseDir",
20 "LICENSE" => "perl",
21 "MIN_PERL_VERSION" => "5.006",
22 "NAME" => "File::BaseDir",
23 "PM" => {
24 "lib/File/BaseDir.pm" => "\$(INST_LIB)/File/BaseDir.pm",
25 "lib/File/IconTheme.pm" => "\$(INST_LIB)/File/IconTheme.pm",
26 "lib/File/UserDirs.pm" => "\$(INST_LIB)/File/UserDirs.pm"
27 },
28 "PREREQ_PM" => {
29 "Exporter" => "5.57",
30 "IPC::System::Simple" => 0
31 },
32 "TEST_REQUIRES" => {
33 "File::Which" => 0,
34 "Test::More" => "0.98"
35 },
36 "VERSION" => "0.09",
37 "test" => {
38 "TESTS" => "t/*.t"
39 }
40 );
41
42 my %FallbackPrereqs = (
43 "Exporter" => "5.57",
44 "File::Which" => 0,
45 "IPC::System::Simple" => 0,
46 "Test::More" => "0.98"
47 );
48
49 unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
50 delete $WriteMakefileArgs{TEST_REQUIRES};
51 delete $WriteMakefileArgs{BUILD_REQUIRES};
52 $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
53 }
54
55 delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
56 unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
57
58 WriteMakefile(%WriteMakefileArgs);
+208
-32
README less more
0 File-BaseDir
1 ============
2
3 This module can be used to find directories and files as specified
4 by the Freedekstop.org Base Directory Specification.
5
6 INSTALLATION
7
8 To install this module type the following:
9
10 perl Build.PL
11 ./Build
12 ./Build test
13 ./Build install
14
15 DEPENDENCIES
16
17 This module requires these other modules which can be obtained from
18 the CPAN <http://cpan.org> if they are not allready installed on
19 your system :
20
21 Module::Build
22 Carp
23 Exporter
24 File::Spec
25
26 COPYRIGHT AND LICENCE
27
28 Copyright (c) 2003, 2007 Jaap G Karssenberg. All rights reserved.
29 This program is free software; you can redistribute it and/or
30 modify it under the same terms as Perl itself.
31
0 NAME
1
2 File::BaseDir - Use the Freedesktop.org base directory specification
3
4 VERSION
5
6 version 0.09
7
8 SYNOPSIS
9
10 use File::BaseDir qw/xdg_data_files/;
11 for ( xdg_data_files('mime/globs') ) {
12 # do something
13 }
14
15 DESCRIPTION
16
17 This module can be used to find directories and files as specified by
18 the Freedesktop.org Base Directory Specification. This specifications
19 gives a mechanism to locate directories for configuration, application
20 data and cache data. It is suggested that desktop applications for e.g.
21 the GNOME, KDE or Xfce platforms follow this layout. However, the same
22 layout can just as well be used for non-GUI applications.
23
24 This module forked from File::MimeInfo.
25
26 This module follows version 0.6 of BaseDir specification.
27
28 CONSTRUCTOR
29
30 new
31
32 my $bd = File::BaseDir->new;
33
34 Simple constructor to allow calling functions as object oriented
35 methods.
36
37 FUNCTIONS
38
39 None of these are exported by default, but all functions can be
40 exported by request. Also the groups :lookup and :vars are defined. The
41 :vars group contains all the routines with a xdg_ prefix. The :lookup
42 group contains the routines to locate files and directories.
43
44 data_home
45
46 my $path = data_home(@path);
47 my $path = $bd->data_home(@path);
48
49 Takes a list of file path elements and returns a new path by appending
50 them to the data home directory. The new path does not need to exist.
51 Use this when writing user specific application data.
52
53 Example:
54
55 # data_home is: /home/USER/.local/share
56 $path = $bd->data_home('Foo', 'Bar', 'Baz');
57 # returns: /home/USER/.local/share/Foo/Bar/Baz
58
59 data_dirs
60
61 # :lookup
62 my $dir = data_dirs(@path);
63 my $dir = $bd->data_dirs(@path);
64 my @dirs = data_dirs(@path);
65 my @dirs = $bd->data_dirs(@path);
66
67 Looks for directories specified by @path in the data home and other
68 data directories. Returns (possibly empty) list of readable
69 directories. In scalar context only the first directory found is
70 returned. Use this to lookup application data.
71
72 data_files
73
74 # :lookup
75 my $file = data_files(@path);
76 my $file = $bd->data_files(@path);
77 my @files = data_files(@path);
78 my @files = $bd->data_files(@path);
79
80 Looks for files specified by @path in the data home and other data
81 directories. Only returns files that are readable. In scalar context
82 only the first file found is returned. Use this to lookup application
83 data.
84
85 config_home
86
87 # :lookup
88 my $dir = config_home(@path);
89 my $dir = $bd->config_home(@path);
90
91 Takes a list of path elements and appends them to the config home
92 directory returning a new path. The new path does not need to exist.
93 Use this when writing user specific configuration.
94
95 config_dirs
96
97 # :lookup
98 my $dir = config_dirs(@path);
99 my $dir = $bd->config_dirs(@path);
100 my @dirs = config_dirs(@path);
101 my @dirs = $bd->config_dirs(@path);
102
103 Looks for directories specified by @path in the config home and other
104 config directories. Returns (possibly empty) list of readable
105 directories. In scalar context only the first directory found is
106 returned. Use this to lookup configuration.
107
108 config_files
109
110 # :lookup
111 my $file = config_files(@path);
112 my $file = $bd->config_files(@path);
113 my @files = config_files(@path);
114 my @files = $bd->config_files(@path);
115
116 Looks for files specified by @path in the config home and other config
117 directories. Returns a (possibly empty) list of files that are
118 readable. In scalar context only the first file found is returned. Use
119 this to lookup configuration.
120
121 cache_home
122
123 # :lookup
124 my $dir = cache_home(@path);
125 my $dir = $bd->cache_home(@path);
126
127 Takes a list of path elements and appends them to the cache home
128 directory returning a new path. The new path does not need to exist.
129
130 xdg_data_home
131
132 # :var
133 my $dir = xdg_data_home;
134 my $dir = $bd->xdg_data_home;
135
136 Returns either $ENV{XDG_DATA_HOME} or it's default value. Default is
137 $HOME/.local/share.
138
139 xdg_data_dirs
140
141 # :var
142 my @dirs = xdg_data_dirs;
143 my @dirs = $bd->xdg_data_dirs;
144
145 Returns either $ENV{XDG_DATA_DIRS} or it's default value as list.
146 Default is /usr/local/share, /usr/share.
147
148 xdg_config_home
149
150 # :var
151 my $dir = xdg_config_home;
152 my $dir = $bd->xdg_config_home;
153
154 Returns either $ENV{XDG_CONFIG_HOME} or it's default value. Default is
155 $HOME/.config.
156
157 xdg_config_dirs
158
159 # :var
160 my @dirs = xdg_config_dirs;
161 my @dirs = $bd->xdg_config_dirs;
162
163 Returns either $ENV{XDG_CONFIG_DIRS} or it's default value as list.
164 Default is /etc/xdg.
165
166 xdg_cache_home
167
168 # :var
169 my $dir = xdg_cache_home;
170 my $dir = $bd->xdg_cache_home;
171
172 Returns either $ENV{XDG_CACHE_HOME} or it's default value. Default is
173 $HOME/.cache.
174
175 NON-UNIX PLATFORMS
176
177 The use of File::Spec ensures that all paths are returned in their
178 native formats regardless of platform. On Windows this module will use
179 the native environment variables, rather than the default on UNIX
180 (which is traditionally $HOME).
181
182 Please note that the specification is targeting Unix platforms only and
183 will only have limited relevance on other platforms. Any platform
184 dependent behavior in this module should be considered an extension of
185 the spec.
186
187 BACKWARDS COMPATIBILITY
188
189 The methods xdg_data_files() and xdg_config_files() are exported for
190 backwards compatibility with version 0.02. They are identical to
191 data_files() and config_files() respectively but without the wantarray
192 behavior.
193
194 AUTHORS
195
196 * Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>
197
198 * Graham Ollis <plicease@cpan.org>
199
200 COPYRIGHT AND LICENSE
201
202 This software is copyright (c) 2003-2021 by Jaap Karssenberg || Pardus
203 [Larus] <pardus@cpan.org>.
204
205 This is free software; you can redistribute it and/or modify it under
206 the same terms as the Perl 5 programming language system itself.
207
0 ---
1 pod_spelling_system:
2 skip: 0
3 # list of words that are spelled correctly
4 # (regardless of what spell check thinks)
5 stopwords:
6 - BaseDir
7 - Freedesktop
8 - Jaap
9 - KDE
10 - Karssenberg
11 - Larus
12 - Pardus
13 - XDG
14 - Xfce
15 - dirs
16 - xdg
17
18 pod_coverage:
19 skip: 0
20 # format is "Class#method" or "Class", regex allowed
21 # for either Class or method.
22 private:
23 - File::BaseDir#xdg_config_files
24 - File::BaseDir#xdg_data_files
25
+0
-2
configure less more
0 #!/bin/sh
1 exec perl ./Makefile.PL "$@"
0 name = File-BaseDir
1 author = Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>
2 author = Graham Ollis <plicease@cpan.org>
3 license = Perl_5
4 copyright_holder = Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>
5 copyright_year = 2003-2021
6 version = 0.09
7
8 [@Author::Plicease]
9 :version = 2.66
10 release_tests = 1
11 github_user = uperl
12
13 workflow = static
14 workflow = linux
15 workflow = macos
16 workflow = windows
17
18 [RemovePrereqs]
19 remove = strict
20 remove = warnings
21 remove = lib
22 remove = File::Path
23 remove = File::Spec
24 remove = File::Spec::Functions
25 remove = File::Temp
26
27 [Author::Plicease::Upload]
28 cpan = 1
29
30 [PruneFiles]
31 filename = xt/release/changes.t
00 package File::BaseDir;
11
22 use strict;
3 use Carp;
4 require File::Spec;
5 require Exporter;
6
7 our $VERSION = 0.08;
8
9 our @ISA = qw(Exporter);
3 use warnings;
4 use Exporter 5.57 qw( import );
5 use File::Spec;
6 use Config;
7
8 # ABSTRACT: Use the Freedesktop.org base directory specification
9 our $VERSION = '0.09'; # VERSION
10
1011 our %EXPORT_TAGS = (
11 vars => [ qw(
12 xdg_data_home xdg_data_dirs
13 xdg_config_home xdg_config_dirs
14 xdg_cache_home
15 ) ],
16 lookup => [ qw(
17 data_home data_dirs data_files
18 config_home config_dirs config_files
19 cache_home
20 ) ],
12 vars => [ qw(
13 xdg_data_home xdg_data_dirs
14 xdg_config_home xdg_config_dirs
15 xdg_cache_home
16 ) ],
17 lookup => [ qw(
18 data_home data_dirs data_files
19 config_home config_dirs config_files
20 cache_home
21 ) ],
2122 );
2223 our @EXPORT_OK = (
23 qw(xdg_data_files xdg_config_files),
24 map @$_, values %EXPORT_TAGS
24 qw(xdg_data_files xdg_config_files),
25 map @$_, values %EXPORT_TAGS
2526 );
2627
27 # Set root and home directories
28 my $rootdir = File::Spec->rootdir();
29 if ($^O eq 'MSWin32') {
30 $rootdir = 'C:\\'; # File::Spec default depends on CWD
31 $ENV{HOME} ||= $ENV{USERPROFILE} || $ENV{HOMEDRIVE}.$ENV{HOMEPATH};
32 # logic from File::HomeDir::Windows
33 }
34 my $home = $ENV{HOME};
35 unless ($home) {
36 # Default to operating system's home dir. NOTE: web applications may not have $ENV{HOME} assigned,
37 # so don't issue a warning. See RT bug #41744
38 $home = $rootdir;
39 }
40
41 # Set defaults
42 our $xdg_data_home = File::Spec->catdir($home, qw/.local share/);
43 our @xdg_data_dirs = (
44 File::Spec->catdir($rootdir, qw/usr local share/),
45 File::Spec->catdir($rootdir, qw/usr share/),
46 );
47 our $xdg_config_home = File::Spec->catdir($home, '.config');
48 our @xdg_config_dirs = ( File::Spec->catdir($rootdir, qw/etc xdg/) );
49 our $xdg_cache_home = File::Spec->catdir($home, '.cache');
28 if($^O eq 'MSWin32')
29 {
30 *_rootdir = sub { 'C:\\' };
31 *_home = sub { $ENV{USERPROFILE} || $ENV{HOMEDRIVE}.$ENV{HOMEPATH} || 'C:\\' };
32 }
33 else
34 {
35 *_rootdir = sub { File::Spec->rootdir };
36 *_home = sub { $ENV{HOME} || eval { [getpwuid($>)]->[7] } || File::Spec->rootdir };
37 }
5038
5139 # OO method
5240 sub new { bless \$VERSION, shift } # what else is there to bless ?
5341
5442 # Variable methods
55 sub xdg_data_home { $ENV{XDG_DATA_HOME} || $xdg_data_home }
43 sub xdg_data_home { $ENV{XDG_DATA_HOME} || File::Spec->catdir(_home(), qw/.local share/) }
5644
5745 sub xdg_data_dirs {
58 ( $ENV{XDG_DATA_DIRS}
59 ? _adapt($ENV{XDG_DATA_DIRS})
60 : @xdg_data_dirs
61 )
62 }
63
64 sub xdg_config_home {$ENV{XDG_CONFIG_HOME} || $xdg_config_home }
46 ( $ENV{XDG_DATA_DIRS}
47 ? _adapt($ENV{XDG_DATA_DIRS})
48 : (File::Spec->catdir(_rootdir(), qw/usr local share/), File::Spec->catdir(_rootdir(), qw/usr share/))
49 )
50 }
51
52 sub xdg_config_home {$ENV{XDG_CONFIG_HOME} || File::Spec->catdir(_home(), '.config') }
6553
6654 sub xdg_config_dirs {
67 ( $ENV{XDG_CONFIG_DIRS}
68 ? _adapt($ENV{XDG_CONFIG_DIRS})
69 : @xdg_config_dirs
70 )
71 }
72
73 sub xdg_cache_home { $ENV{XDG_CACHE_HOME} || $xdg_cache_home }
55 ( $ENV{XDG_CONFIG_DIRS}
56 ? _adapt($ENV{XDG_CONFIG_DIRS})
57 : File::Spec->catdir(_rootdir(), qw/etc xdg/)
58 )
59 }
60
61 sub xdg_cache_home { $ENV{XDG_CACHE_HOME} || File::Spec->catdir(_home(), '.cache') }
7462
7563 sub _adapt {
76 map { File::Spec->catdir( split('/', $_) ) } split /[:;]/, shift;
77 # ':' defined in the spec, but ';' is standard on win32
64 map { File::Spec->catdir( split(/\//, $_) ) } split /\Q$Config{path_sep}\E/, shift;
65 # ':' defined in the spec, but ';' is standard on win32
7866 }
7967
8068 # Lookup methods
9785 sub cache_home { _catfile(xdg_cache_home, @_) }
9886
9987 sub _catfile {
100 my $dir = shift;
101 shift if ref $_[0] or $_[0] =~ /::/; # OO call
102 return File::Spec->catfile($dir, @_);
88 my $dir = shift;
89 shift if ref $_[0] or $_[0] =~ /::/; # OO call
90 return File::Spec->catfile($dir, @_);
10391 }
10492
10593 sub _find_files {
106 my $type = shift;
107 my $file = shift;
108 shift @$file if ref $$file[0] or $$file[0] =~ /::/; # OO call
109 #warn "Looking for: @$file\n in: @_\n";
110 if (wantarray) {
111 return grep { &$type( $_ ) && -r $_ }
112 map { File::Spec->catfile($_, @$file) } @_;
113 }
114 else { # prevent unnecessary stats by returning early
115 for (@_) {
116 my $path = File::Spec->catfile($_, @$file);
117 return $path if &$type($path) && -r $path;
118 }
119 }
120 return ();
94 my $type = shift;
95 my $file = shift;
96 shift @$file if ref $$file[0] or $$file[0] =~ /::/; # OO call
97 #warn "Looking for: @$file\n in: @_\n";
98 if (wantarray) { ## no critic (Community::Wantarray)
99 return grep { &$type( $_ ) && -r $_ }
100 map { File::Spec->catfile($_, @$file) } @_;
101 }
102 else { # prevent unnecessary stats by returning early
103 for (@_) {
104 my $path = File::Spec->catfile($_, @$file);
105 return $path if &$type($path) && -r $path;
106 }
107 }
108 return ();
121109 }
122110
123111 sub _dir { -d $_[0] }
128116
129117 __END__
130118
119 =pod
120
121 =encoding UTF-8
122
131123 =head1 NAME
132124
133125 File::BaseDir - Use the Freedesktop.org base directory specification
134126
127 =head1 VERSION
128
129 version 0.09
130
135131 =head1 SYNOPSIS
136132
137 use File::BaseDir qw/xdg_data_files/;
138 for ( xdg_data_files('mime/globs') ) {
139 # do something
140 }
133 use File::BaseDir qw/xdg_data_files/;
134 for ( xdg_data_files('mime/globs') ) {
135 # do something
136 }
141137
142138 =head1 DESCRIPTION
143139
144140 This module can be used to find directories and files as specified
145141 by the Freedesktop.org Base Directory Specification. This specifications
146142 gives a mechanism to locate directories for configuration, application data
147 and cache data. It is suggested that desktop applications for e.g. the
148 Gnome, KDE or Xfce platforms follow this layout. However, the same layout can
143 and cache data. It is suggested that desktop applications for e.g. the
144 GNOME, KDE or Xfce platforms follow this layout. However, the same layout can
149145 just as well be used for non-GUI applications.
150146
151147 This module forked from L<File::MimeInfo>.
152148
153149 This module follows version 0.6 of BaseDir specification.
154150
155 =head1 EXPORT
156
157 None by default, but all methods can be exported on demand.
158 Also the groups ":lookup" and ":vars" are defined. The ":vars" group
159 contains all routines with a "xdg_" prefix; the ":lookup" group
160 contains the routines to locate files and directories.
161
162 =head1 METHODS
163
164 =over 4
165
166 =item C<new()>
167
168 Simple constructor to allow Object Oriented use of this module.
169
170 =back
171
172 =head2 Lookup
173
174 The following methods are used to lookup files and folders in one of the
175 search paths.
176
177 =over 4
178
179 =item C<data_home(@PATH)>
151 =head1 CONSTRUCTOR
152
153 =head2 new
154
155 my $bd = File::BaseDir->new;
156
157 Simple constructor to allow calling functions as object oriented methods.
158
159 =head1 FUNCTIONS
160
161 None of these are exported by default, but all functions can be exported
162 by request. Also the groups C<:lookup> and C<:vars> are defined. The
163 C<:vars> group contains all the routines with a C<xdg_> prefix. The
164 C<:lookup> group contains the routines to locate files and directories.
165
166 =head2 data_home
167
168 my $path = data_home(@path);
169 my $path = $bd->data_home(@path);
180170
181171 Takes a list of file path elements and returns a new path by appending
182172 them to the data home directory. The new path does not need to exist.
184174
185175 Example:
186176
187 # data_home is: /home/USER/.local/share
188 $path = $bd->data_home('Foo', 'Bar', 'Baz');
189 # returns: /home/USER/.local/share/Foo/Bar/Baz
190
191 =item C<data_dirs(@PATH)>
192
193 Looks for directories specified by C<@PATH> in the data home and
177 # data_home is: /home/USER/.local/share
178 $path = $bd->data_home('Foo', 'Bar', 'Baz');
179 # returns: /home/USER/.local/share/Foo/Bar/Baz
180
181 =head2 data_dirs
182
183 # :lookup
184 my $dir = data_dirs(@path);
185 my $dir = $bd->data_dirs(@path);
186 my @dirs = data_dirs(@path);
187 my @dirs = $bd->data_dirs(@path);
188
189 Looks for directories specified by C<@path> in the data home and
194190 other data directories. Returns (possibly empty) list of readable
195191 directories. In scalar context only the first directory found is
196192 returned. Use this to lookup application data.
197193
198 =item C<data_files(@PATH)>
199
200 Looks for files specified by C<@PATH> in the data home and other data
194 =head2 data_files
195
196 # :lookup
197 my $file = data_files(@path);
198 my $file = $bd->data_files(@path);
199 my @files = data_files(@path);
200 my @files = $bd->data_files(@path);
201
202 Looks for files specified by C<@path> in the data home and other data
201203 directories. Only returns files that are readable. In scalar context only
202204 the first file found is returned. Use this to lookup application data.
203205
204 =item C<config_home(@PATH)>
206 =head2 config_home
207
208 # :lookup
209 my $dir = config_home(@path);
210 my $dir = $bd->config_home(@path);
205211
206212 Takes a list of path elements and appends them to the config home
207213 directory returning a new path. The new path does not need to exist.
208214 Use this when writing user specific configuration.
209215
210 =item C<config_dirs(@PATH)>
211
212 Looks for directories specified by C<@PATH> in the config home and
216 =head2 config_dirs
217
218 # :lookup
219 my $dir = config_dirs(@path);
220 my $dir = $bd->config_dirs(@path);
221 my @dirs = config_dirs(@path);
222 my @dirs = $bd->config_dirs(@path);
223
224 Looks for directories specified by C<@path> in the config home and
213225 other config directories. Returns (possibly empty) list of readable
214226 directories. In scalar context only the first directory found is
215227 returned. Use this to lookup configuration.
216228
217 =item C<config_files(@PATH)>
218
219 Looks for files specified by C<@PATH> in the config home and other
229 =head2 config_files
230
231 # :lookup
232 my $file = config_files(@path);
233 my $file = $bd->config_files(@path);
234 my @files = config_files(@path);
235 my @files = $bd->config_files(@path);
236
237 Looks for files specified by C<@path> in the config home and other
220238 config directories. Returns a (possibly empty) list of files that
221239 are readable. In scalar context only the first file found is returned.
222240 Use this to lookup configuration.
223241
224 =item C<cache_home(@PATH)>
242 =head2 cache_home
243
244 # :lookup
245 my $dir = cache_home(@path);
246 my $dir = $bd->cache_home(@path);
225247
226248 Takes a list of path elements and appends them to the cache home
227249 directory returning a new path. The new path does not need to exist.
228250
229 =back
230
231 =head2 Variables
232
233 The following methods only returns the value of one of the XDG variables.
234
235 =over 4
236
237 =item C<xdg_data_home>
251 =head2 xdg_data_home
252
253 # :var
254 my $dir = xdg_data_home;
255 my $dir = $bd->xdg_data_home;
238256
239257 Returns either C<$ENV{XDG_DATA_HOME}> or it's default value.
240258 Default is F<$HOME/.local/share>.
241259
242 =item C<xdg_data_dirs>
260 =head2 xdg_data_dirs
261
262 # :var
263 my @dirs = xdg_data_dirs;
264 my @dirs = $bd->xdg_data_dirs;
243265
244266 Returns either C<$ENV{XDG_DATA_DIRS}> or it's default value as list.
245267 Default is F</usr/local/share>, F</usr/share>.
246268
247 =item C<xdg_config_home>
269 =head2 xdg_config_home
270
271 # :var
272 my $dir = xdg_config_home;
273 my $dir = $bd->xdg_config_home;
248274
249275 Returns either C<$ENV{XDG_CONFIG_HOME}> or it's default value.
250276 Default is F<$HOME/.config>.
251277
252 =item C<xdg_config_dirs>
278 =head2 xdg_config_dirs
279
280 # :var
281 my @dirs = xdg_config_dirs;
282 my @dirs = $bd->xdg_config_dirs;
253283
254284 Returns either C<$ENV{XDG_CONFIG_DIRS}> or it's default value as list.
255285 Default is F</etc/xdg>.
256286
257 =item C<xdg_cache_home>
287 =head2 xdg_cache_home
288
289 # :var
290 my $dir = xdg_cache_home;
291 my $dir = $bd->xdg_cache_home;
258292
259293 Returns either C<$ENV{XDG_CACHE_HOME}> or it's default value.
260294 Default is F<$HOME/.cache>.
261295
262 =back
263
264296 =head1 NON-UNIX PLATFORMS
265297
266 The use of L<File::Spec> ensures that all paths are returned in the appropriate
267 form for the current platform. On Windows this module will try to set C<$HOME>
268 to a sensible value if it is not defined yet. On other platforms one can use
269 e.g. L<File::HomeDir> to set $HOME before loading File::BaseDir.
298 The use of L<File::Spec> ensures that all paths are returned in their native
299 formats regardless of platform. On Windows this module will use the native
300 environment variables, rather than the default on UNIX (which is traditionally
301 C<$HOME>).
270302
271303 Please note that the specification is targeting Unix platforms only and
272304 will only have limited relevance on other platforms. Any platform dependent
278310 backwards compatibility with version 0.02. They are identical to C<data_files()>
279311 and C<config_files()> respectively but without the C<wantarray> behavior.
280312
281 =head1 BUGS
282
283 Please mail the author if you encounter any bugs.
284
285 =head1 AUTHOR
286
287 Jaap Karssenberg || Pardus [Larus] E<lt>pardus@cpan.orgE<gt>
288
289 Copyright (c) 2003, 2007 Jaap G Karssenberg. All rights reserved.
290 This program is free software; you can redistribute it and/or
291 modify it under the same terms as Perl itself.
292
293 Currently being maintained by Kim Ryan
294
295 =head1 SEE ALSO
296
297 L<http://www.freedesktop.org/wiki/Specifications/basedir-spec>
298
313 =head1 AUTHORS
314
315 =over 4
316
317 =item *
318
319 Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>
320
321 =item *
322
323 Graham Ollis <plicease@cpan.org>
324
325 =back
326
327 =head1 COPYRIGHT AND LICENSE
328
329 This software is copyright (c) 2003-2021 by Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>.
330
331 This is free software; you can redistribute it and/or modify it under
332 the same terms as the Perl 5 programming language system itself.
333
334 =cut
00 package File::IconTheme;
1
12 use strict;
2 use warnings FATAL => 'all';
3 use warnings;
34 use File::BaseDir qw(data_dirs);
4 require File::Spec;
5 use parent qw(Exporter);
5 use File::Spec;
6 use Exporter 5.57 qw( import );
67
7 our $VERSION = '0.08';
8 # ABSTRACT: Find icon directories
9 our $VERSION = '0.09'; # VERSION
10
811 our @EXPORT_OK = qw(xdg_icon_theme_search_dirs);
912
1013 sub xdg_icon_theme_search_dirs {
14
1115 return grep {-d $_ && -r $_}
12 File::Spec->catfile($ENV{HOME}, '.icons'),
16 File::Spec->catfile(File::BaseDir->_home, '.icons'),
1317 data_dirs('icons'),
1418 '/usr/share/pixmaps';
1519 }
1822
1923 __END__
2024
25 =pod
26
27 =encoding UTF-8
28
2129 =head1 NAME
2230
23 File::IconTheme - find icon directories
31 File::IconTheme - Find icon directories
2432
2533 =head1 VERSION
2634
27 This document describes File::IconTheme.
35 version 0.09
2836
2937 =head1 SYNOPSIS
3038
31 use File::IconTheme qw(xdg_icon_theme_search_dirs);
32 print join "\n", xdg_icon_theme_search_dirs;
39 use File::IconTheme qw(xdg_icon_theme_search_dirs);
40 print join "\n", xdg_icon_theme_search_dirs;
3341
3442 =head1 DESCRIPTION
3543
3947
4048 In case you want to B<store> an icon theme, use the directory returned by:
4149
42 use File::BaseDir qw(data_dirs);
43 print scalar data_dirs('icons');
50 use File::BaseDir qw(data_dirs);
51 print scalar data_dirs('icons');
4452
45 =head1 INTERFACE
53 =head1 FUNCTIONS
4654
47 =over
55 Can be exported on request.
4856
49 =item C<xdg_icon_theme_search_dirs>
57 =head2 xdg_icon_theme_search_dirs
58
59 my @dirs = xdg_icon_theme_search_dir;
5060
5161 Returns a list of the base directories of icon themes.
52
53 =back
54
55 =head1 EXPORTS
56
57 None by default, but the method can be exported on demand.
5862
5963 =head1 CONFIGURATION AND ENVIRONMENT
6064
6367 =head1 SEE ALSO
6468
6569 L<http://standards.freedesktop.org/icon-theme-spec/>
70
71 =head1 AUTHORS
72
73 =over 4
74
75 =item *
76
77 Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>
78
79 =item *
80
81 Graham Ollis <plicease@cpan.org>
82
83 =back
84
85 =head1 COPYRIGHT AND LICENSE
86
87 This software is copyright (c) 2003-2021 by Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>.
88
89 This is free software; you can redistribute it and/or modify it under
90 the same terms as the Perl 5 programming language system itself.
91
92 =cut
00 package File::UserDirs;
1
12 use strict;
2 use warnings FATAL => 'all';
3 use warnings;
34 use IPC::System::Simple qw(capturex);
4 use parent qw(Exporter);
5 use Exporter 5.57 qw( import );
56
6 our $VERSION = '0.08';
7 # ABSTRACT: Find extra media and documents directories
8 our $VERSION = '0.09'; # VERSION
9
710 our %EXPORT_TAGS = (
811 all => [
912 qw(xdg_desktop_dir xdg_documents_dir xdg_download_dir xdg_music_dir
3235
3336 __END__
3437
38 =pod
39
40 =encoding UTF-8
41
3542 =head1 NAME
3643
37 File::UserDirs - find extra media and documents directories
44 File::UserDirs - Find extra media and documents directories
3845
3946 =head1 VERSION
4047
41 This document describes File::UserDirs version C<0.04>.
48 version 0.09
4249
4350 =head1 SYNOPSIS
4451
45 use File::UserDirs qw(:all);
46 print xdg_desktop_dir; # e.g. /home/user/Desktop
52 use File::UserDirs qw(:all);
53 print xdg_desktop_dir; # e.g. /home/user/Desktop
4754
4855 =head1 DESCRIPTION
4956
5158 by the Freedesktop.org xdg-user-dirs software. This
5259 gives a mechanism to locate extra directories for media and documents files.
5360
54 =head1 INTERFACE
61 =head1 FUNCTIONS
5562
56 =over
63 May be exported on request.
64 Also the group C<:all> is defined which exports all methods.
5765
58 =item C<xdg_desktop_dir>
66 =head2 xdg_desktop_dir
67
68 my $dir = xdg_desktop_dir;
5969
6070 Returns the desktop directory. Unless changed by the user,
6171 this is the directory F<Desktop> in the home directory.
6272
63 =item C<xdg_documents_dir>
73 =head2 xdg_documents_dir
74
75 my $dir = xdg_documents_dir;
6476
6577 Returns the documents directory. Unless changed by the user,
6678 this is the home directory.
6779
68 =item C<xdg_download_dir>
80 =head2 xdg_download_dir
81
82 my $dir = xdg_download_dir;
6983
7084 Returns the download directory. Unless changed by the user,
7185 this is the home directory.
7286
73 =item C<xdg_music_dir>
87 =head2 xdg_music_dir
88
89 my $dir = xdg_music_dir;
7490
7591 Returns the music directory. Unless changed by the user,
7692 this is the home directory.
7793
78 =item C<xdg_pictures_dir>
94 =head2 xdg_pictures_dir
95
96 my $dir = xdg_pictures_dir;
7997
8098 Returns the pictures directory. Unless changed by the user,
8199 this is the home directory.
82100
83 =item C<xdg_publicshare_dir>
101 =head2 xdg_publicshare_dir
102
103 my $dir = xdg_publicshare_dir;
84104
85105 Returns the public share directory. Unless changed by the user,
86106 this is the home directory.
87107
88 =item C<xdg_templates_dir>
108 =head2 xdg_templates_dir
109
110 my $dir = xdg_templates_dir;
89111
90112 Returns the templates directory. Unless changed by the user,
91113 this is the home directory.
92114
93 =item C<xdg_videos_dir>
115 =head2 xdg_videos_dir
116
117 my $dir = xdg_videos_dir;
94118
95119 Returns the videos directory. Unless changed by the user,
96120 this is the home directory.
97
98 =back
99
100 =head1 EXPORTS
101
102 None by default, but any method can be exported on demand.
103 Also the group C<:all> is defined which exports all methods.
104121
105122 =head1 DIAGNOSTICS
106123
119136 F<$XDG_CONFIG_HOME/user-dirs.dirs>. It is a shell file setting a number of
120137 environment variables. To find the exact pathname from Perl, run:
121138
122 use File::BaseDir qw(config_home);
123 print config_home('user-dirs.dirs');
139 use File::BaseDir qw(config_home);
140 print config_home('user-dirs.dirs');
124141
125142 =head2 Example customised F<user-dirs.dirs>
126143
127 XDG_DESKTOP_DIR="$HOME/Workspace"
128 XDG_DOCUMENTS_DIR="$HOME/Files"
129 XDG_DOWNLOAD_DIR="$HOME/Files/Downloads"
130 XDG_MUSIC_DIR="$HOME/Files/Audio"
131 XDG_PICTURES_DIR="$HOME/Files/Images"
132 XDG_PUBLICSHARE_DIR="$HOME/public_html"
133 XDG_TEMPLATES_DIR="$HOME/Files/Document templates"
134 XDG_VIDEOS_DIR="$HOME/Files/Video"
144 XDG_DESKTOP_DIR="$HOME/Workspace"
145 XDG_DOCUMENTS_DIR="$HOME/Files"
146 XDG_DOWNLOAD_DIR="$HOME/Files/Downloads"
147 XDG_MUSIC_DIR="$HOME/Files/Audio"
148 XDG_PICTURES_DIR="$HOME/Files/Images"
149 XDG_PUBLICSHARE_DIR="$HOME/public_html"
150 XDG_TEMPLATES_DIR="$HOME/Files/Document templates"
151 XDG_VIDEOS_DIR="$HOME/Files/Video"
135152
136153 =head1 DEPENDENCIES
137154
139156 C<xdg-user-dirs>. Source code is available from
140157 L<http://cgit.freedesktop.org/xdg/xdg-user-dirs/>.
141158
142 =head1 SEE ALSO
159 =head1 AUTHORS
143160
161 =over 4
162
163 =item *
164
165 Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>
166
167 =item *
168
169 Graham Ollis <plicease@cpan.org>
170
171 =back
172
173 =head1 COPYRIGHT AND LICENSE
174
175 This software is copyright (c) 2003-2021 by Jaap Karssenberg || Pardus [Larus] <pardus@cpan.org>.
176
177 This is free software; you can redistribute it and/or modify it under
178 the same terms as the Perl 5 programming language system itself.
179
180 =cut
0 severity = 1
1 only = 1
2
3 [Community::ArrayAssignAref]
4 [Community::BarewordFilehandles]
5 [Community::ConditionalDeclarations]
6 [Community::ConditionalImplicitReturn]
7 [Community::DeprecatedFeatures]
8 [Community::DiscouragedModules]
9 [Community::DollarAB]
10 [Community::Each]
11 [Community::IndirectObjectNotation]
12 [Community::LexicalForeachIterator]
13 [Community::LoopOnHash]
14 [Community::ModPerl]
15 [Community::OpenArgs]
16 [Community::OverloadOptions]
17 [Community::POSIXImports]
18 [Community::PackageMatchesFilename]
19 [Community::PreferredAlternatives]
20 [Community::StrictWarnings]
21 extra_importers = Test2::V0
22 [Community::Threads]
23 [Community::Wantarray]
24 [Community::WarningsSwitch]
25 [Community::WhileDiamondDefaultAssignment]
26
27 [BuiltinFunctions::ProhibitBooleanGrep]
28 ;[BuiltinFunctions::ProhibitStringyEval]
29 [BuiltinFunctions::ProhibitStringySplit]
30 [BuiltinFunctions::ProhibitVoidGrep]
31 [BuiltinFunctions::ProhibitVoidMap]
32 [ClassHierarchies::ProhibitExplicitISA]
33 [ClassHierarchies::ProhibitOneArgBless]
34 [CodeLayout::ProhibitHardTabs]
35 allow_leading_tabs = 0
36 [CodeLayout::ProhibitTrailingWhitespace]
37 [CodeLayout::RequireConsistentNewlines]
38 [ControlStructures::ProhibitLabelsWithSpecialBlockNames]
39 [ControlStructures::ProhibitMutatingListFunctions]
40 [ControlStructures::ProhibitUnreachableCode]
41 [InputOutput::ProhibitBarewordFileHandles]
42 [InputOutput::ProhibitJoinedReadline]
43 [InputOutput::ProhibitTwoArgOpen]
44 [Miscellanea::ProhibitFormats]
45 [Miscellanea::ProhibitUselessNoCritic]
46 [Modules::ProhibitConditionalUseStatements]
47 ;[Modules::RequireEndWithOne]
48 [Modules::RequireNoMatchVarsWithUseEnglish]
49 [Objects::ProhibitIndirectSyntax]
50 [RegularExpressions::ProhibitUselessTopic]
51 [Subroutines::ProhibitNestedSubs]
52 [ValuesAndExpressions::ProhibitLeadingZeros]
53 [ValuesAndExpressions::ProhibitMixedBooleanOperators]
54 [ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator]
55 [ValuesAndExpressions::RequireUpperCaseHeredocTerminator]
56 [Variables::ProhibitPerl4PackageNames]
57 [Variables::ProhibitUnusedVariables]
0 use strict;
1 use warnings;
2 use Config;
3 use Test::More tests => 1;
4
5 # This .t file is generated.
6 # make changes instead to dist.ini
7
8 my %modules;
9 my $post_diag;
10
11 $modules{$_} = $_ for qw(
12 Exporter
13 ExtUtils::MakeMaker
14 File::Which
15 IPC::System::Simple
16 Test::More
17 );
18
19
20
21 my @modules = sort keys %modules;
22
23 sub spacer ()
24 {
25 diag '';
26 diag '';
27 diag '';
28 }
29
30 pass 'okay';
31
32 my $max = 1;
33 $max = $_ > $max ? $_ : $max for map { length $_ } @modules;
34 our $format = "%-${max}s %s";
35
36 spacer;
37
38 my @keys = sort grep /(MOJO|PERL|\A(LC|HARNESS)_|\A(SHELL|LANG)\Z)/i, keys %ENV;
39
40 if(@keys > 0)
41 {
42 diag "$_=$ENV{$_}" for @keys;
43
44 if($ENV{PERL5LIB})
45 {
46 spacer;
47 diag "PERL5LIB path";
48 diag $_ for split $Config{path_sep}, $ENV{PERL5LIB};
49
50 }
51 elsif($ENV{PERLLIB})
52 {
53 spacer;
54 diag "PERLLIB path";
55 diag $_ for split $Config{path_sep}, $ENV{PERLLIB};
56 }
57
58 spacer;
59 }
60
61 diag sprintf $format, 'perl', "$] $^O $Config{archname}";
62
63 foreach my $module (@modules)
64 {
65 my $pm = "$module.pm";
66 $pm =~ s{::}{/}g;
67 if(eval { require $pm; 1 })
68 {
69 my $ver = eval { $module->VERSION };
70 $ver = 'undef' unless defined $ver;
71 diag sprintf $format, $module, $ver;
72 }
73 else
74 {
75 diag sprintf $format, $module, '-';
76 }
77 }
78
79 if($post_diag)
80 {
81 spacer;
82 $post_diag->();
83 }
84
85 spacer;
86
00 use strict;
1 use Test::More tests => 12;
1 use warnings;
2 use Test::More tests => 14;
3 use Config;
24
35 use_ok('File::BaseDir', qw/:vars/);
46
5 my $rootdir = ($^O eq 'MSWin32') ? 'c:\\' : File::Spec->rootdir();
6 ok(length($ENV{HOME}), 'HOME defined');
7 note "home = @{[ File::BaseDir->_home ]}";
8 ok(File::BaseDir->_home, 'HOME defined');
9 note "root = @{[ File::BaseDir->_rootdir ]}";
10 ok(File::BaseDir->_rootdir, 'root defined');
711
812 $ENV{XDG_CONFIG_HOME} = '';
9 ok( xdg_config_home() eq File::Spec->catdir($ENV{HOME}, qw/.config/),
10 'xdg_config_home default');
13 ok( xdg_config_home() eq File::Spec->catdir(File::BaseDir->_home, qw/.config/),
14 'xdg_config_home default');
1115 $ENV{XDG_CONFIG_HOME} = 'test123';
1216 ok( xdg_config_home() eq 'test123', 'xdg_data_home set');
1317
1418 $ENV{XDG_CONFIG_DIRS} = '';
1519 is_deeply( [xdg_config_dirs()],
16 [ File::Spec->catdir($rootdir, qw/etc xdg/) ],
17 'xdg_config_dirs default');
18 $ENV{XDG_CONFIG_DIRS} = './t:foo:bar';
20 [ File::Spec->catdir(File::BaseDir->_rootdir, qw/etc xdg/) ],
21 'xdg_config_dirs default');
22 $ENV{XDG_CONFIG_DIRS} = join $Config{path_sep}, qw/ t foo bar /;
1923 is_deeply( [xdg_config_dirs()],
2024 [File::Spec->catdir('.', 't'), 'foo', 'bar'],
21 'xdg_data_dirs set');
25 'xdg_data_dirs set');
2226
2327 $ENV{XDG_DATA_HOME} = '';
24 ok( xdg_data_home() eq File::Spec->catdir($ENV{HOME}, qw/.local share/),
25 'xdg_data_home default');
28 ok( xdg_data_home() eq File::Spec->catdir(File::BaseDir->_home, qw/.local share/),
29 'xdg_data_home default');
2630 $ENV{XDG_DATA_HOME} = 'test123';
2731 ok( xdg_data_home() eq 'test123', 'xdg_data_home set');
2832
2933 $ENV{XDG_DATA_DIRS} = '';
3034 is_deeply( [xdg_data_dirs()],
31 [ File::Spec->catdir($rootdir, qw/usr local share/),
32 File::Spec->catdir($rootdir, qw/usr share/) ],
33 'xdg_data_dirs default');
34 $ENV{XDG_DATA_DIRS} = './t:foo:bar';
35 [ File::Spec->catdir(File::BaseDir->_rootdir, qw/usr local share/),
36 File::Spec->catdir(File::BaseDir->_rootdir, qw/usr share/) ],
37 'xdg_data_dirs default');
38 $ENV{XDG_DATA_DIRS} = join $Config{path_sep}, qw/ t foo bar /;
3539 is_deeply( [xdg_data_dirs()],
3640 [File::Spec->catdir('.', 't'), 'foo', 'bar'],
37 'xdg_data_dirs set');
41 'xdg_data_dirs set');
3842
3943 $ENV{XDG_CACHE_HOME} = '';
40 ok( xdg_cache_home() eq File::Spec->catdir($ENV{HOME}, qw/.cache/),
41 'xdg_cache_home default');
44 ok( xdg_cache_home() eq File::Spec->catdir(File::BaseDir->_home, qw/.cache/),
45 'xdg_cache_home default');
4246 $ENV{XDG_CACHE_HOME} = 'test123';
4347 ok( xdg_cache_home() eq 'test123', 'xdg_cache_home set');
4448
49 ok 1;
00 use strict;
1 use warnings;
12 use Test::More tests => 17;
23 use File::Spec;
4 use lib 't/lib';
5 use Config;
6 use Helper qw( build_test_data );
37
48 use_ok('File::BaseDir', qw/:lookup xdg_data_files xdg_config_files/);
59
610 # Initalize test data:
711
812 # t/
9 # `-- data/ $dir[1]
10 # |-- dir/ $dir[2]
11 # | `-- test $file[1]
12 # `-- test $file[0]
13 # `-- data/ $dir[1]
14 # |-- dir/ $dir[2]
15 # | `-- test $file[1]
16 # `-- test $file[0]
1317
14 my @dir = ('t', map File::Spec->catdir(@$_),
15 [qw/t data/], [qw/t data dir/] );
16 my @file = (map File::Spec->catfile(@$_),
17 [qw/t data test/], [qw/t data dir test/] );
18 mkdir $dir[1] or die $! unless -d $dir[1];
19 mkdir $dir[2] or die $! unless -d $dir[2];
20 open TEST, ">$file[0]" or die $!;
21 print TEST "test 1 2 3\n";
22 close TEST;
23 eval { chmod 0644, $file[0] }; # reset previous run
24 open TEST, ">$file[1]" or die $!;
25 print TEST "test 1 2 3\n";
26 close TEST;
18 my$root = build_test_data;
19
20 my @dir = (map File::Spec->catdir($root, @$_),
21 ['t'], [qw/t data/], [qw/t data dir/] );
22 my @file = (map File::Spec->catfile($root, @$_),
23 [qw/t data test/], [qw/t data dir test/] );
24
2725
2826 $ENV{XDG_CONFIG_HOME} = 'foo';
2927 $ENV{XDG_CONFIG_DIRS} = 'bar';
30 $ENV{XDG_DATA_HOME} = '.';
31 $ENV{XDG_DATA_DIRS} = join ':', @dir;
28 $ENV{XDG_DATA_HOME} = $root;
29 $ENV{XDG_DATA_DIRS} = join $Config{path_sep}, @dir;
3230
3331 is(data_home(qw/t data test/), $file[0], 'data_home');
3432 is(data_files(qw/data test/), $file[0], 'data_files');
4038 ok(!data_dirs(qw/data test/), 'data_dirs does not match file');
4139
4240 is_deeply([xdg_data_files(qw/test/)], \@file,
43 'xdg_data_files - for backward compatibility');
41 'xdg_data_files - for backward compatibility');
4442
45 $ENV{XDG_CONFIG_HOME} = '.';
46 $ENV{XDG_CONFIG_DIRS} = join ':', @dir;
43 $ENV{XDG_CONFIG_HOME} = $root;
44 $ENV{XDG_CONFIG_DIRS} = join $Config{path_sep}, @dir;
4745 $ENV{XDG_DATA_HOME} = 'foo';
4846 $ENV{XDG_DATA_DIRS} = 'bar';
4947
5452 is_deeply([config_dirs(qw/data dir/)], [$dir[2]], 'config_dirs - list');
5553
5654 is_deeply([xdg_config_files(qw/test/)], \@file,
57 'xdg_config_files - for backward compatibility');
55 'xdg_config_files - for backward compatibility');
5856
5957 SKIP: {
60 eval { chmod 0200, $file[0] }; # make non-readable
61 skip "chmod not supported", 1 if -r $file[0];
62 is(config_files(qw/test/), $file[1], 'config_files checks for read');
58 eval { chmod 0200, $file[0] }; # make non-readable
59 skip "chmod not supported", 1 if -r $file[0];
60 is(config_files(qw/test/), $file[1], 'config_files checks for read');
6361 }
6462
65 $ENV{XDG_CACHE_HOME} = 't/data';
66 ok(cache_home('test') eq $file[0], 'data_cache');
63 $ENV{XDG_CACHE_HOME} = File::Spec->catdir($root, 't/data');
64 is(cache_home('test'), $file[0], 'data_cache');
6765
00 use strict;
1 use warnings;
12 use Test::More tests => 6;
3 use File::Spec;
24 use File::BaseDir;
3
4 my $rootdir = ($^O eq 'MSWin32') ? 'c:\\' : File::Spec->rootdir();
5 use lib 't/lib';
6 use Helper qw( build_test_data );
57
68 my $conf = File::BaseDir->new;
9 isa_ok $conf, 'File::BaseDir';
710
8 is(ref($conf), 'File::BaseDir', 'OO constructor works');
11 {
12 my $rootdir = ($^O eq 'MSWin32') ? 'c:\\' : File::Spec->rootdir();
913
10 $ENV{XDG_DATA_DIRS} = '';
11 is_deeply( [$conf->xdg_data_dirs()],
12 [ File::Spec->catdir($rootdir, qw/usr local share/),
13 File::Spec->catdir($rootdir, qw/usr share/) ],
14 'xdg_data_dirs default - OO');
14 $ENV{XDG_DATA_DIRS} = '';
15 is_deeply( [$conf->xdg_data_dirs()],
16 [ File::Spec->catdir($rootdir, qw/usr local share/),
17 File::Spec->catdir($rootdir, qw/usr share/) ],
18 'xdg_data_dirs default - OO');
19 }
1520
16 $ENV{XDG_DATA_HOME} = 't';
17 is($conf->data_dirs('data'), File::Spec->catdir(qw/t data/),
18 'data_dirs - OO');
19 is(File::BaseDir->data_dirs('data'), File::Spec->catdir(qw/t data/),
20 'data_dirs - Module');
21 {
22 my $root = build_test_data;
2123
22 is($conf->data_home('data', 'test'), File::Spec->catfile(qw/t data test/),
23 'data_home - OO');
24 is(File::BaseDir->data_home('data', 'test'), File::Spec->catfile(qw/t data test/),
25 'data_home - Module');
24 $ENV{XDG_DATA_HOME} = File::Spec->catdir($root, 't');
25 is($conf->data_dirs('data'), File::Spec->catdir($root, qw/t data/),
26 'data_dirs - OO');
27 is(File::BaseDir->data_dirs('data'), File::Spec->catdir($root, qw/t data/),
28 'data_dirs - Module');
29
30 is($conf->data_home('data', 'test'), File::Spec->catfile($root, qw/t data test/),
31 'data_home - OO');
32 is(File::BaseDir->data_home('data', 'test'), File::Spec->catfile($root, qw/t data test/),
33 'data_home - Module');
34 }
0 #!perl
10 use strict;
2 use warnings FATAL => 'all';
1 use warnings;
32 use Test::More;
43 use Config;
4 use File::BaseDir;
55 use File::IconTheme qw(xdg_icon_theme_search_dirs);
6 require File::Spec;
6 use File::Spec;
77 use File::Temp qw();
88
99 if ($^O eq 'MSWin32') {
2323 is_deeply
2424 [xdg_icon_theme_search_dirs],
2525 [grep {-d $_ && -r $_}
26 File::Spec->catfile($ENV{HOME}, '.icons'),
26 File::Spec->catfile(File::BaseDir->_home, '.icons'),
2727 @icondirs,
2828 '/usr/share/pixmaps'
2929 ];
30
30
0 #!perl
10 use strict;
2 use warnings FATAL => 'all';
1 use warnings;
32 use Test::More;
43 use File::UserDirs qw(:all);
54 use File::BaseDir qw(config_home);
1211 plan tests => 8;
1312 $xdg_user_dir_installed = 1;
1413 } else {
15 plan skip_all => '"xdg-user-dir" executable not found. Install package "xdg-user-dirs".';
16
14 plan skip_all => '"xdg-user-dir" executable not found. Install package "xdg-user-dirs".';
15
1716 }
1817
1918 my $temphomedir = tempdir(CLEANUP => 1);
+0
-4
t/04_pod_ok.t less more
0 use Test::More;
1 eval "use Test::Pod 1.00";
2 plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
3 all_pod_files_ok( Test::Pod::all_pod_files(qw/bin lib/) );
+0
-9
t/05_pod_cover.t less more
0 use Test::More;
1
2 use File::BaseDir qw/xdg_data_dirs/;
3 $ENV{XDG_DATA_DIRS} = join ':', 'share', xdg_data_dirs;
4
5 eval "use Test::Pod::Coverage 1.00";
6 plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;
7 all_pod_coverage_ok(
8 { also_private => [ qr/^_/, qr/^xdg_.*_files$/ ] } );
0 package Helper;
1
2 use strict;
3 use warnings;
4 use File::Temp qw( tempdir );
5 use File::Path qw( mkpath );
6 use Test::More ();
7 use Exporter qw( import );
8
9 our @EXPORT_OK = qw( build_test_data );
10
11 sub build_test_data {
12 my $root = tempdir( CLEANUP => 1 );
13
14 my $dir = File::Spec->catdir($root, 't','data','dir');
15 Test::More::note "mkpath $dir";
16 mkpath($dir, 0, oct('0700'));
17
18 foreach my $file (map { File::Spec->catfile($root, @$_) } ['t','data','test'], ['t','data','dir','test']) {
19 Test::More::note "create $file";
20 open my $fh, '>', $file or die "unable to write $file $!";
21 print $fh "test 1 2 3\n";
22 close $fh;
23 }
24
25 $root;
26 }
27
28 1;
0 use Test2::Require::Module 'Test2::Tools::PerlCritic';
1 use Test2::Require::Module 'Perl::Critic';
2 use Test2::Require::Module 'Perl::Critic::Community';
3 use Test2::V0;
4 use Perl::Critic;
5 use Test2::Tools::PerlCritic;
6
7 my $critic = Perl::Critic->new(
8 -profile => 'perlcriticrc',
9 );
10
11 perl_critic_ok ['lib','t'], $critic;
12
13 done_testing;
0 use strict;
1 use warnings;
2 use Test::More;
3 BEGIN {
4 plan skip_all => 'test requires Test::EOL'
5 unless eval q{ use Test::EOL; 1 };
6 };
7 use Test::EOL;
8 use FindBin;
9 use File::Spec;
10
11 chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir));
12
13 all_perl_files_ok(grep { -e $_ } qw( bin lib t Makefile.PL ));
14
15
0 use strict;
1 use warnings;
2 use Test::More;
3 BEGIN {
4 plan skip_all => 'test requires Test::NoTabs'
5 unless eval q{ use Test::NoTabs; 1 };
6 };
7 use Test::NoTabs;
8 use FindBin;
9 use File::Spec;
10
11 chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir));
12
13 all_perl_files_ok( grep { -e $_ } qw( bin lib t Makefile.PL ));
14
15
0 use strict;
1 use warnings;
2 use Test::More;
3 BEGIN {
4 plan skip_all => 'test requires Test::Pod'
5 unless eval q{ use Test::Pod; 1 };
6 };
7 use Test::Pod;
8 use FindBin;
9 use File::Spec;
10
11 chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir));
12
13 all_pod_files_ok( grep { -e $_ } qw( bin lib ));
14
15
0 use strict;
1 use warnings;
2 use Test::More;
3 BEGIN {
4 plan skip_all => 'test requires 5.010 or better'
5 unless $] >= 5.010;
6 plan skip_all => 'test requires Test::Pod::Coverage'
7 unless eval q{ use Test::Pod::Coverage; 1 };
8 plan skip_all => 'test requires YAML'
9 unless eval q{ use YAML; 1; };
10 plan skip_all => 'test does not always work in cip check'
11 if defined $ENV{CIPSTATIC} && $ENV{CIPSTATIC} eq 'true';
12 };
13 use Test::Pod::Coverage;
14 use YAML qw( LoadFile );
15 use FindBin;
16 use File::Spec;
17
18 my $config_filename = File::Spec->catfile(
19 $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml'
20 );
21
22 my $config;
23 $config = LoadFile($config_filename)
24 if -r $config_filename;
25
26 plan skip_all => 'disabled' if $config->{pod_coverage}->{skip};
27
28 chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir));
29
30 my @private_classes;
31 my %private_methods;
32
33 push $config->{pod_coverage}->{private}->@*,
34 'Alien::.*::Install::Files#Inline';
35
36 foreach my $private ($config->{pod_coverage}->{private}->@*)
37 {
38 my($class,$method) = split /#/, $private;
39 if(defined $class && $class ne '')
40 {
41 my $regex = eval 'qr{^' . $class . '$}';
42 if(defined $method && $method ne '')
43 {
44 push @private_classes, { regex => $regex, method => $method };
45 }
46 else
47 {
48 push @private_classes, { regex => $regex, all => 1 };
49 }
50 }
51 elsif(defined $method && $method ne '')
52 {
53 $private_methods{$_} = 1 for split /,/, $method;
54 }
55 }
56
57 my @classes = all_modules;
58
59 plan tests => scalar @classes;
60
61 foreach my $class (@classes)
62 {
63 SKIP: {
64 my($is_private_class) = map { 1 } grep { $class =~ $_->{regex} && $_->{all} } @private_classes;
65 skip "private class: $class", 1 if $is_private_class;
66
67 my %methods = map {; $_ => 1 } map { split /,/, $_->{method} } grep { $class =~ $_->{regex} } @private_classes;
68 $methods{$_} = 1 for keys %private_methods;
69
70 my $also_private = eval 'qr{^' . join('|', keys %methods ) . '$}';
71
72 pod_coverage_ok $class, { also_private => [$also_private] };
73 };
74 }
75
76
0 use strict;
1 use warnings;
2 use Test::More;
3 BEGIN {
4 plan skip_all => 'test requires Test::Pod::Spelling::CommonMistakes'
5 unless eval q{ use Test::Pod::Spelling::CommonMistakes; 1 };
6 plan skip_all => 'test requires YAML'
7 unless eval q{ use YAML qw( LoadFile ); 1 };
8 };
9 use Test::Pod::Spelling::CommonMistakes;
10 use FindBin;
11 use File::Spec;
12
13 my $config_filename = File::Spec->catfile(
14 $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml'
15 );
16
17 my $config;
18 $config = LoadFile($config_filename)
19 if -r $config_filename;
20
21 plan skip_all => 'disabled' if $config->{pod_spelling_common}->{skip};
22
23 chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir));
24
25 # TODO: test files in bin too.
26 all_pod_files_ok;
27
28
0 use strict;
1 use warnings;
2 use Test::More;
3 BEGIN {
4 plan skip_all => 'test requires Test::Spelling'
5 unless eval q{ use Test::Spelling; 1 };
6 plan skip_all => 'test requires YAML'
7 unless eval q{ use YAML; 1; };
8 };
9 use Test::Spelling;
10 use YAML qw( LoadFile );
11 use FindBin;
12 use File::Spec;
13
14 my $config_filename = File::Spec->catfile(
15 $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml'
16 );
17
18 my $config;
19 $config = LoadFile($config_filename)
20 if -r $config_filename;
21
22 plan skip_all => 'disabled' if $config->{pod_spelling_system}->{skip};
23
24 chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir));
25
26 add_stopwords($config->{pod_spelling_system}->{stopwords}->@*);
27 add_stopwords(qw(
28 Plicease
29 stdout
30 stderr
31 stdin
32 subref
33 loopback
34 username
35 os
36 Ollis
37 Mojolicious
38 plicease
39 CPAN
40 reinstall
41 TODO
42 filename
43 filenames
44 login
45 callback
46 callbacks
47 standalone
48 VMS
49 hostname
50 hostnames
51 TCP
52 UDP
53 IP
54 API
55 MSWin32
56 OpenBSD
57 FreeBSD
58 NetBSD
59 unencrypted
60 WebSocket
61 WebSockets
62 timestamp
63 timestamps
64 poney
65 BackPAN
66 portably
67 RedHat
68 AIX
69 BSD
70 XS
71 FFI
72 perlish
73 optimizations
74 subdirectory
75 RESTful
76 SQLite
77 JavaScript
78 dir
79 plugins
80 munge
81 jQuery
82 namespace
83 PDF
84 PDFs
85 usernames
86 DBI
87 pluggable
88 APIs
89 SSL
90 JSON
91 YAML
92 uncommented
93 Solaris
94 OpenVMS
95 URI
96 URL
97 CGI
98 ));
99 all_pod_files_spelling_ok;
100
101
0 use strict;
1 use warnings;
2 use Test::More;
3 BEGIN {
4 plan skip_all => 'test requires Test::Strict'
5 unless eval q{ use Test::Strict; 1 };
6 };
7 use Test::Strict;
8 use FindBin;
9 use File::Spec;
10
11 chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir));
12
13 unshift @Test::Strict::MODULES_ENABLING_STRICT,
14 'ozo',
15 'Test2::Bundle::SIPS',
16 'Test2::V0',
17 'Test2::Bundle::Extended';
18 note "enabling strict = $_" for @Test::Strict::MODULES_ENABLING_STRICT;
19
20 all_perl_files_ok( grep { -e $_ } qw( bin lib t Makefile.PL ));
21
22
0 use strict;
1 use warnings;
2 use Test::More;
3 use FindBin ();
4 BEGIN {
5
6 plan skip_all => "test requires Test::Version 2.00"
7 unless eval q{
8 use Test::Version 2.00 qw( version_all_ok ), {
9 has_version => 1,
10 filename_match => sub { $_[0] !~ m{/(ConfigData|Install/Files)\.pm$} },
11 };
12 1
13 };
14
15 plan skip_all => 'test requires YAML'
16 unless eval q{ use YAML; 1; };
17 }
18
19 use YAML qw( LoadFile );
20 use FindBin;
21 use File::Spec;
22
23 my $config_filename = File::Spec->catfile(
24 $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml'
25 );
26
27 my $config;
28 $config = LoadFile($config_filename)
29 if -r $config_filename;
30
31 if($config->{version}->{dir})
32 {
33 note "using dir " . $config->{version}->{dir}
34 }
35
36 version_all_ok($config->{version}->{dir} ? ($config->{version}->{dir}) : ());
37 done_testing;
38
0 use strict;
1 use warnings;
2 use Test::More;
3 BEGIN {
4 plan skip_all => 'test requires Test::Fixme'
5 unless eval q{ use Test::Fixme 0.14; 1 };
6 };
7 use Test::Fixme 0.07;
8 use FindBin;
9 use File::Spec;
10
11 chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir));
12
13 run_tests(
14 match => qr/FIXME/,
15 where => [ grep { -e $_ } qw( bin lib t Makefile.PL Build.PL )],
16 warn => 1,
17 );
18
19