File-BaseDir-0.09000755001750001750 014071655100 13574 5ustar00ollisgollisg000000000000README100644001750001750 1371514071655100 14564 0ustar00ollisgollisg000000000000File-BaseDir-0.09NAME File::BaseDir - Use the Freedesktop.org base directory specification VERSION version 0.09 SYNOPSIS use File::BaseDir qw/xdg_data_files/; for ( xdg_data_files('mime/globs') ) { # do something } DESCRIPTION This module can be used to find directories and files as specified by the Freedesktop.org Base Directory Specification. This specifications gives a mechanism to locate directories for configuration, application data and cache data. It is suggested that desktop applications for e.g. the GNOME, KDE or Xfce platforms follow this layout. However, the same layout can just as well be used for non-GUI applications. This module forked from File::MimeInfo. This module follows version 0.6 of BaseDir specification. CONSTRUCTOR new my $bd = File::BaseDir->new; Simple constructor to allow calling functions as object oriented methods. FUNCTIONS None of these are exported by default, but all functions can be exported by request. Also the groups :lookup and :vars are defined. The :vars group contains all the routines with a xdg_ prefix. The :lookup group contains the routines to locate files and directories. data_home my $path = data_home(@path); my $path = $bd->data_home(@path); Takes a list of file path elements and returns a new path by appending them to the data home directory. The new path does not need to exist. Use this when writing user specific application data. Example: # data_home is: /home/USER/.local/share $path = $bd->data_home('Foo', 'Bar', 'Baz'); # returns: /home/USER/.local/share/Foo/Bar/Baz data_dirs # :lookup my $dir = data_dirs(@path); my $dir = $bd->data_dirs(@path); my @dirs = data_dirs(@path); my @dirs = $bd->data_dirs(@path); Looks for directories specified by @path in the data home and other data directories. Returns (possibly empty) list of readable directories. In scalar context only the first directory found is returned. Use this to lookup application data. data_files # :lookup my $file = data_files(@path); my $file = $bd->data_files(@path); my @files = data_files(@path); my @files = $bd->data_files(@path); Looks for files specified by @path in the data home and other data directories. Only returns files that are readable. In scalar context only the first file found is returned. Use this to lookup application data. config_home # :lookup my $dir = config_home(@path); my $dir = $bd->config_home(@path); Takes a list of path elements and appends them to the config home directory returning a new path. The new path does not need to exist. Use this when writing user specific configuration. config_dirs # :lookup my $dir = config_dirs(@path); my $dir = $bd->config_dirs(@path); my @dirs = config_dirs(@path); my @dirs = $bd->config_dirs(@path); Looks for directories specified by @path in the config home and other config directories. Returns (possibly empty) list of readable directories. In scalar context only the first directory found is returned. Use this to lookup configuration. config_files # :lookup my $file = config_files(@path); my $file = $bd->config_files(@path); my @files = config_files(@path); my @files = $bd->config_files(@path); Looks for files specified by @path in the config home and other config directories. Returns a (possibly empty) list of files that are readable. In scalar context only the first file found is returned. Use this to lookup configuration. cache_home # :lookup my $dir = cache_home(@path); my $dir = $bd->cache_home(@path); Takes a list of path elements and appends them to the cache home directory returning a new path. The new path does not need to exist. xdg_data_home # :var my $dir = xdg_data_home; my $dir = $bd->xdg_data_home; Returns either $ENV{XDG_DATA_HOME} or it's default value. Default is $HOME/.local/share. xdg_data_dirs # :var my @dirs = xdg_data_dirs; my @dirs = $bd->xdg_data_dirs; Returns either $ENV{XDG_DATA_DIRS} or it's default value as list. Default is /usr/local/share, /usr/share. xdg_config_home # :var my $dir = xdg_config_home; my $dir = $bd->xdg_config_home; Returns either $ENV{XDG_CONFIG_HOME} or it's default value. Default is $HOME/.config. xdg_config_dirs # :var my @dirs = xdg_config_dirs; my @dirs = $bd->xdg_config_dirs; Returns either $ENV{XDG_CONFIG_DIRS} or it's default value as list. Default is /etc/xdg. xdg_cache_home # :var my $dir = xdg_cache_home; my $dir = $bd->xdg_cache_home; Returns either $ENV{XDG_CACHE_HOME} or it's default value. Default is $HOME/.cache. NON-UNIX PLATFORMS The use of File::Spec ensures that all paths are returned in their native formats regardless of platform. On Windows this module will use the native environment variables, rather than the default on UNIX (which is traditionally $HOME). Please note that the specification is targeting Unix platforms only and will only have limited relevance on other platforms. Any platform dependent behavior in this module should be considered an extension of the spec. BACKWARDS COMPATIBILITY The methods xdg_data_files() and xdg_config_files() are exported for backwards compatibility with version 0.02. They are identical to data_files() and config_files() respectively but without the wantarray behavior. AUTHORS * Jaap Karssenberg || Pardus [Larus] * Graham Ollis COPYRIGHT AND LICENSE This software is copyright (c) 2003-2021 by Jaap Karssenberg || Pardus [Larus] . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Changes100644001750001750 301714071655100 15151 0ustar00ollisgollisg000000000000File-BaseDir-0.09Revision history for File-BaseDir 0.09 2021-07-08 14:04:14 -0600 - Tests can now be run in parallel or isolation safely (rt#199256) - Fallback on getpwuid if environment variable not set (rt#127138) - Test suite works with or without environment variables (rt#127138) 0.08 13 Mar 2018 Fix for failing test in 03_userdirs.t, thanks to Pierre Labastie 0.07 21 Apr 2015 Use temporary files for 03_userdirs.t test, fix for RT bug 103805 0.06 6 Apr 2015 Added prerequsite module build_requires section of Build.PL 0.05 4 Apr 2015 Added prerequsitie module to Build.PL 0.04 3 Apr 2015 Fix for RT bug #41744 . Remove warning message when $ENV{HOME} is not defined Fix for RT bugs # 88502 and #54929, typos corrected Fix for RT bug #41744 . Remove warning message when $ENV{HOME} is not defined Fix for RT bugs #50343, added more functionality Fixed some OS depedendancies in test suite. 0.03 Wed Oct 24 2007 - Added lookup methods for files and dirs: data_home, data_files, data_dirs, config_home, config_files, config_dirs & cache_home; suggested by Matisse Enzer - Deprecated xdg_data_files and xdg_config_files; suggested by Michael Schwern - Added a bit of Win32 support - Extended tests to full coverage 0.02 Thu Sep 4 2003 - forgot to remove h2xs default "use 5.008" tag :( emergency release it is ... 0.01 Wed Sep 3 18:33:59 2003 - original version; created by h2xs 1.22 with options -AX -n File::BaseDir - Added methods for all environment variables defined by the spec LICENSE100644001750001750 4406414071655100 14712 0ustar00ollisgollisg000000000000File-BaseDir-0.09This software is copyright (c) 2003-2021 by Jaap Karssenberg || Pardus [Larus] . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2003-2021 by Jaap Karssenberg || Pardus [Larus] . This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2003-2021 by Jaap Karssenberg || Pardus [Larus] . This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End INSTALL100644001750001750 455314071655100 14715 0ustar00ollisgollisg000000000000File-BaseDir-0.09This is the Perl distribution File-BaseDir. Installing File-BaseDir is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm File::BaseDir If it does not have permission to install modules to the current perl, cpanm will automatically set up and install to a local::lib in your home directory. See the local::lib documentation (https://metacpan.org/pod/local::lib) for details on enabling it in your environment. ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan File::BaseDir ## Manual installation As a last resort, you can manually install it. If you have not already downloaded the release tarball, you can find the download link on the module's MetaCPAN page: https://metacpan.org/pod/File::BaseDir Untar the tarball, install configure prerequisites (see below), then build it: % perl Makefile.PL % make && make test Then install it: % make install On Windows platforms, you should use `dmake` or `nmake`, instead of `make`. If your perl is system-managed, you can create a local::lib in your home directory to install modules to. For details, see the local::lib documentation: https://metacpan.org/pod/local::lib The prerequisites of this distribution will also have to be installed manually. The prerequisites are listed in one of the files: `MYMETA.yml` or `MYMETA.json` generated by running the manual build process described above. ## Configure Prerequisites This distribution requires other modules to be installed before this distribution's installer can be run. They can be found under the "configure_requires" key of META.yml or the "{prereqs}{configure}{requires}" key of META.json. ## Other Prerequisites This distribution may require additional modules to be installed after running Makefile.PL. Look for prerequisites in the following phases: * to run make, PHASE = build * to use the module code itself, PHASE = runtime * to run tests, PHASE = test They can all be found in the "PHASE_requires" key of MYMETA.yml or the "{prereqs}{PHASE}{requires}" key of MYMETA.json. ## Documentation File-BaseDir documentation is available as POD. You can run `perldoc` from a shell to read the documentation: % perldoc File::BaseDir For more information on installing Perl modules via CPAN, please see: https://www.cpan.org/modules/INSTALL.html dist.ini100644001750001750 127314071655100 15324 0ustar00ollisgollisg000000000000File-BaseDir-0.09name = File-BaseDir author = Jaap Karssenberg || Pardus [Larus] author = Graham Ollis license = Perl_5 copyright_holder = Jaap Karssenberg || Pardus [Larus] copyright_year = 2003-2021 version = 0.09 [@Author::Plicease] :version = 2.66 release_tests = 1 github_user = uperl workflow = static workflow = linux workflow = macos workflow = windows [RemovePrereqs] remove = strict remove = warnings remove = lib remove = File::Path remove = File::Spec remove = File::Spec::Functions remove = File::Temp [Author::Plicease::Upload] cpan = 1 [PruneFiles] filename = xt/release/changes.t META.yml100644001750001750 167414071655100 15136 0ustar00ollisgollisg000000000000File-BaseDir-0.09--- abstract: 'Use the Freedesktop.org base directory specification' author: - 'Jaap Karssenberg || Pardus [Larus] ' - 'Graham Ollis ' build_requires: File::Which: '0' Test::More: '0.98' perl: '5.006' configure_requires: ExtUtils::MakeMaker: '0' perl: '5.006' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.022, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: File-BaseDir requires: Exporter: '5.57' IPC::System::Simple: '0' perl: '5.006' resources: bugtracker: https://github.com/uperl/File-BaseDir/issues homepage: https://metacpan.org/pod/File::BaseDir repository: git://github.com/uperl/File-BaseDir.git version: '0.09' x_generated_by_perl: v5.34.0 x_serialization_backend: 'YAML::Tiny version 1.73' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' x_use_unsafe_inc: 0 MANIFEST100644001750001750 106314071655100 15006 0ustar00ollisgollisg000000000000File-BaseDir-0.09# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.022. Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README author.yml dist.ini lib/File/BaseDir.pm lib/File/IconTheme.pm lib/File/UserDirs.pm perlcriticrc t/00_diag.t t/01_vars.t t/02_lookup.t t/03_OO.t t/03_icontheme.t t/03_userdirs.t t/lib/Helper.pm xt/author/critic.t xt/author/eol.t xt/author/no_tabs.t xt/author/pod.t xt/author/pod_coverage.t xt/author/pod_spelling_common.t xt/author/pod_spelling_system.t xt/author/strict.t xt/author/version.t xt/release/fixme.t t000755001750001750 014071655100 13760 5ustar00ollisgollisg000000000000File-BaseDir-0.0903_OO.t100644001750001750 201314071655100 15120 0ustar00ollisgollisg000000000000File-BaseDir-0.09/tuse strict; use warnings; use Test::More tests => 6; use File::Spec; use File::BaseDir; use lib 't/lib'; use Helper qw( build_test_data ); my $conf = File::BaseDir->new; isa_ok $conf, 'File::BaseDir'; { my $rootdir = ($^O eq 'MSWin32') ? 'c:\\' : File::Spec->rootdir(); $ENV{XDG_DATA_DIRS} = ''; is_deeply( [$conf->xdg_data_dirs()], [ File::Spec->catdir($rootdir, qw/usr local share/), File::Spec->catdir($rootdir, qw/usr share/) ], 'xdg_data_dirs default - OO'); } { my $root = build_test_data; $ENV{XDG_DATA_HOME} = File::Spec->catdir($root, 't'); is($conf->data_dirs('data'), File::Spec->catdir($root, qw/t data/), 'data_dirs - OO'); is(File::BaseDir->data_dirs('data'), File::Spec->catdir($root, qw/t data/), 'data_dirs - Module'); is($conf->data_home('data', 'test'), File::Spec->catfile($root, qw/t data test/), 'data_home - OO'); is(File::BaseDir->data_home('data', 'test'), File::Spec->catfile($root, qw/t data test/), 'data_home - Module'); } META.json100644001750001750 423114071655100 15276 0ustar00ollisgollisg000000000000File-BaseDir-0.09{ "abstract" : "Use the Freedesktop.org base directory specification", "author" : [ "Jaap Karssenberg || Pardus [Larus] ", "Graham Ollis " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.022, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "File-BaseDir", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0", "perl" : "5.006" } }, "develop" : { "requires" : { "FindBin" : "0", "Perl::Critic" : "0", "Test2::Require::Module" : "0.000121", "Test2::Tools::PerlCritic" : "0", "Test2::V0" : "0.000121", "Test::EOL" : "0", "Test::Fixme" : "0.07", "Test::More" : "0.98", "Test::NoTabs" : "0", "Test::Pod" : "0", "Test::Pod::Coverage" : "0", "Test::Pod::Spelling::CommonMistakes" : "0", "Test::Spelling" : "0", "Test::Strict" : "0", "YAML" : "0" } }, "runtime" : { "requires" : { "Exporter" : "5.57", "IPC::System::Simple" : "0", "perl" : "5.006" } }, "test" : { "requires" : { "File::Which" : "0", "Test::More" : "0.98", "perl" : "5.006" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/uperl/File-BaseDir/issues" }, "homepage" : "https://metacpan.org/pod/File::BaseDir", "repository" : { "type" : "git", "url" : "git://github.com/uperl/File-BaseDir.git", "web" : "https://github.com/uperl/File-BaseDir" } }, "version" : "0.09", "x_generated_by_perl" : "v5.34.0", "x_serialization_backend" : "Cpanel::JSON::XS version 4.26", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later", "x_use_unsafe_inc" : 0 } author.yml100644001750001750 71414071655100 15664 0ustar00ollisgollisg000000000000File-BaseDir-0.09--- pod_spelling_system: skip: 0 # list of words that are spelled correctly # (regardless of what spell check thinks) stopwords: - BaseDir - Freedesktop - Jaap - KDE - Karssenberg - Larus - Pardus - XDG - Xfce - dirs - xdg pod_coverage: skip: 0 # format is "Class#method" or "Class", regex allowed # for either Class or method. private: - File::BaseDir#xdg_config_files - File::BaseDir#xdg_data_files 01_vars.t100644001750001750 332414071655100 15562 0ustar00ollisgollisg000000000000File-BaseDir-0.09/tuse strict; use warnings; use Test::More tests => 14; use Config; use_ok('File::BaseDir', qw/:vars/); note "home = @{[ File::BaseDir->_home ]}"; ok(File::BaseDir->_home, 'HOME defined'); note "root = @{[ File::BaseDir->_rootdir ]}"; ok(File::BaseDir->_rootdir, 'root defined'); $ENV{XDG_CONFIG_HOME} = ''; ok( xdg_config_home() eq File::Spec->catdir(File::BaseDir->_home, qw/.config/), 'xdg_config_home default'); $ENV{XDG_CONFIG_HOME} = 'test123'; ok( xdg_config_home() eq 'test123', 'xdg_data_home set'); $ENV{XDG_CONFIG_DIRS} = ''; is_deeply( [xdg_config_dirs()], [ File::Spec->catdir(File::BaseDir->_rootdir, qw/etc xdg/) ], 'xdg_config_dirs default'); $ENV{XDG_CONFIG_DIRS} = join $Config{path_sep}, qw/ t foo bar /; is_deeply( [xdg_config_dirs()], [File::Spec->catdir('.', 't'), 'foo', 'bar'], 'xdg_data_dirs set'); $ENV{XDG_DATA_HOME} = ''; ok( xdg_data_home() eq File::Spec->catdir(File::BaseDir->_home, qw/.local share/), 'xdg_data_home default'); $ENV{XDG_DATA_HOME} = 'test123'; ok( xdg_data_home() eq 'test123', 'xdg_data_home set'); $ENV{XDG_DATA_DIRS} = ''; is_deeply( [xdg_data_dirs()], [ File::Spec->catdir(File::BaseDir->_rootdir, qw/usr local share/), File::Spec->catdir(File::BaseDir->_rootdir, qw/usr share/) ], 'xdg_data_dirs default'); $ENV{XDG_DATA_DIRS} = join $Config{path_sep}, qw/ t foo bar /; is_deeply( [xdg_data_dirs()], [File::Spec->catdir('.', 't'), 'foo', 'bar'], 'xdg_data_dirs set'); $ENV{XDG_CACHE_HOME} = ''; ok( xdg_cache_home() eq File::Spec->catdir(File::BaseDir->_home, qw/.cache/), 'xdg_cache_home default'); $ENV{XDG_CACHE_HOME} = 'test123'; ok( xdg_cache_home() eq 'test123', 'xdg_cache_home set'); ok 1; 00_diag.t100644001750001750 241614071655100 15513 0ustar00ollisgollisg000000000000File-BaseDir-0.09/tuse strict; use warnings; use Config; use Test::More tests => 1; # This .t file is generated. # make changes instead to dist.ini my %modules; my $post_diag; $modules{$_} = $_ for qw( Exporter ExtUtils::MakeMaker File::Which IPC::System::Simple Test::More ); my @modules = sort keys %modules; sub spacer () { diag ''; diag ''; diag ''; } pass 'okay'; my $max = 1; $max = $_ > $max ? $_ : $max for map { length $_ } @modules; our $format = "%-${max}s %s"; spacer; my @keys = sort grep /(MOJO|PERL|\A(LC|HARNESS)_|\A(SHELL|LANG)\Z)/i, keys %ENV; if(@keys > 0) { diag "$_=$ENV{$_}" for @keys; if($ENV{PERL5LIB}) { spacer; diag "PERL5LIB path"; diag $_ for split $Config{path_sep}, $ENV{PERL5LIB}; } elsif($ENV{PERLLIB}) { spacer; diag "PERLLIB path"; diag $_ for split $Config{path_sep}, $ENV{PERLLIB}; } spacer; } diag sprintf $format, 'perl', "$] $^O $Config{archname}"; foreach my $module (@modules) { my $pm = "$module.pm"; $pm =~ s{::}{/}g; if(eval { require $pm; 1 }) { my $ver = eval { $module->VERSION }; $ver = 'undef' unless defined $ver; diag sprintf $format, $module, $ver; } else { diag sprintf $format, $module, '-'; } } if($post_diag) { spacer; $post_diag->(); } spacer; Makefile.PL100644001750001750 323314071655100 15630 0ustar00ollisgollisg000000000000File-BaseDir-0.09BEGIN { use strict; use warnings; unless(eval q{ use 5.006; 1}) { print "Perl 5.006 or better required\n"; exit; } } # This file was automatically generated by Dist::Zilla::Plugin::Author::Plicease::MakeMaker v2.66. use strict; use warnings; use 5.006; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Use the Freedesktop.org base directory specification", "AUTHOR" => "Jaap Karssenberg || Pardus [Larus] , Graham Ollis ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "File-BaseDir", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.006", "NAME" => "File::BaseDir", "PM" => { "lib/File/BaseDir.pm" => "\$(INST_LIB)/File/BaseDir.pm", "lib/File/IconTheme.pm" => "\$(INST_LIB)/File/IconTheme.pm", "lib/File/UserDirs.pm" => "\$(INST_LIB)/File/UserDirs.pm" }, "PREREQ_PM" => { "Exporter" => "5.57", "IPC::System::Simple" => 0 }, "TEST_REQUIRES" => { "File::Which" => 0, "Test::More" => "0.98" }, "VERSION" => "0.09", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Exporter" => "5.57", "File::Which" => 0, "IPC::System::Simple" => 0, "Test::More" => "0.98" ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs);perlcriticrc100644001750001750 367014071655100 16273 0ustar00ollisgollisg000000000000File-BaseDir-0.09severity = 1 only = 1 [Community::ArrayAssignAref] [Community::BarewordFilehandles] [Community::ConditionalDeclarations] [Community::ConditionalImplicitReturn] [Community::DeprecatedFeatures] [Community::DiscouragedModules] [Community::DollarAB] [Community::Each] [Community::IndirectObjectNotation] [Community::LexicalForeachIterator] [Community::LoopOnHash] [Community::ModPerl] [Community::OpenArgs] [Community::OverloadOptions] [Community::POSIXImports] [Community::PackageMatchesFilename] [Community::PreferredAlternatives] [Community::StrictWarnings] extra_importers = Test2::V0 [Community::Threads] [Community::Wantarray] [Community::WarningsSwitch] [Community::WhileDiamondDefaultAssignment] [BuiltinFunctions::ProhibitBooleanGrep] ;[BuiltinFunctions::ProhibitStringyEval] [BuiltinFunctions::ProhibitStringySplit] [BuiltinFunctions::ProhibitVoidGrep] [BuiltinFunctions::ProhibitVoidMap] [ClassHierarchies::ProhibitExplicitISA] [ClassHierarchies::ProhibitOneArgBless] [CodeLayout::ProhibitHardTabs] allow_leading_tabs = 0 [CodeLayout::ProhibitTrailingWhitespace] [CodeLayout::RequireConsistentNewlines] [ControlStructures::ProhibitLabelsWithSpecialBlockNames] [ControlStructures::ProhibitMutatingListFunctions] [ControlStructures::ProhibitUnreachableCode] [InputOutput::ProhibitBarewordFileHandles] [InputOutput::ProhibitJoinedReadline] [InputOutput::ProhibitTwoArgOpen] [Miscellanea::ProhibitFormats] [Miscellanea::ProhibitUselessNoCritic] [Modules::ProhibitConditionalUseStatements] ;[Modules::RequireEndWithOne] [Modules::RequireNoMatchVarsWithUseEnglish] [Objects::ProhibitIndirectSyntax] [RegularExpressions::ProhibitUselessTopic] [Subroutines::ProhibitNestedSubs] [ValuesAndExpressions::ProhibitLeadingZeros] [ValuesAndExpressions::ProhibitMixedBooleanOperators] [ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator] [ValuesAndExpressions::RequireUpperCaseHeredocTerminator] [Variables::ProhibitPerl4PackageNames] [Variables::ProhibitUnusedVariables] 02_lookup.t100644001750001750 403014071655100 16114 0ustar00ollisgollisg000000000000File-BaseDir-0.09/tuse strict; use warnings; use Test::More tests => 17; use File::Spec; use lib 't/lib'; use Config; use Helper qw( build_test_data ); use_ok('File::BaseDir', qw/:lookup xdg_data_files xdg_config_files/); # Initalize test data: # t/ # `-- data/ $dir[1] # |-- dir/ $dir[2] # | `-- test $file[1] # `-- test $file[0] my$root = build_test_data; my @dir = (map File::Spec->catdir($root, @$_), ['t'], [qw/t data/], [qw/t data dir/] ); my @file = (map File::Spec->catfile($root, @$_), [qw/t data test/], [qw/t data dir test/] ); $ENV{XDG_CONFIG_HOME} = 'foo'; $ENV{XDG_CONFIG_DIRS} = 'bar'; $ENV{XDG_DATA_HOME} = $root; $ENV{XDG_DATA_DIRS} = join $Config{path_sep}, @dir; is(data_home(qw/t data test/), $file[0], 'data_home'); is(data_files(qw/data test/), $file[0], 'data_files'); is_deeply([data_files(qw/test/)], \@file, 'data_files - list'); is(data_dirs(qw/data dir/), $dir[2], 'data_dirs'); is_deeply([data_dirs(qw/data dir/)], [$dir[2]], 'data_dirs - list'); ok(!data_files(qw/data dir/), 'data_files does not match dir'); ok(!data_dirs(qw/data test/), 'data_dirs does not match file'); is_deeply([xdg_data_files(qw/test/)], \@file, 'xdg_data_files - for backward compatibility'); $ENV{XDG_CONFIG_HOME} = $root; $ENV{XDG_CONFIG_DIRS} = join $Config{path_sep}, @dir; $ENV{XDG_DATA_HOME} = 'foo'; $ENV{XDG_DATA_DIRS} = 'bar'; is(config_home(qw/t data test/), $file[0], 'config_home'); is(config_files(qw/data test/), $file[0], 'config_files'); is_deeply([config_files(qw/test/)], \@file, 'config_files - list'); is(config_dirs(qw/data dir/), $dir[2], 'config_dirs'); is_deeply([config_dirs(qw/data dir/)], [$dir[2]], 'config_dirs - list'); is_deeply([xdg_config_files(qw/test/)], \@file, 'xdg_config_files - for backward compatibility'); SKIP: { eval { chmod 0200, $file[0] }; # make non-readable skip "chmod not supported", 1 if -r $file[0]; is(config_files(qw/test/), $file[1], 'config_files checks for read'); } $ENV{XDG_CACHE_HOME} = File::Spec->catdir($root, 't/data'); is(cache_home('test'), $file[0], 'data_cache'); 03_userdirs.t100644001750001750 274514071655100 16457 0ustar00ollisgollisg000000000000File-BaseDir-0.09/tuse strict; use warnings; use Test::More; use File::UserDirs qw(:all); use File::BaseDir qw(config_home); use File::Spec::Functions qw(catfile); use File::Which qw(which); use File::Temp qw(tempdir); my $xdg_user_dir_installed = 0; if (which 'xdg-user-dir') { plan tests => 8; $xdg_user_dir_installed = 1; } else { plan skip_all => '"xdg-user-dir" executable not found. Install package "xdg-user-dirs".'; } my $temphomedir = tempdir(CLEANUP => 1); local $ENV{HOME} = $temphomedir; local $ENV{XDG_CONFIG_HOME} = ''; mkdir "$temphomedir/.config"; my $udd = "$temphomedir/.config/user-dirs.dirs"; open my $fh, '>', $udd or die "could not open $udd for writing: $!"; print $fh <<'UDD'; XDG_DESKTOP_DIR="$HOME/Workspace" XDG_DOCUMENTS_DIR="$HOME/Files" XDG_DOWNLOAD_DIR="$HOME/Files/Downloads" XDG_MUSIC_DIR="$HOME/Files/Audio" XDG_PICTURES_DIR="$HOME/Files/Images" XDG_PUBLICSHARE_DIR="$HOME/public_html" XDG_TEMPLATES_DIR="$HOME/Files/Document templates" XDG_VIDEOS_DIR="$HOME/Files/Video" UDD close $fh; is xdg_desktop_dir, catfile($ENV{HOME}, 'Workspace'); is xdg_documents_dir, catfile($ENV{HOME}, 'Files'); is xdg_download_dir, catfile($ENV{HOME}, 'Files/Downloads'); is xdg_music_dir, catfile($ENV{HOME}, 'Files/Audio'); is xdg_pictures_dir, catfile($ENV{HOME}, 'Files/Images'); is xdg_publicshare_dir, catfile($ENV{HOME}, 'public_html'); is xdg_templates_dir, catfile($ENV{HOME}, 'Files/Document templates'); is xdg_videos_dir, catfile($ENV{HOME}, 'Files/Video'); lib000755001750001750 014071655100 14526 5ustar00ollisgollisg000000000000File-BaseDir-0.09/tHelper.pm100644001750001750 121214071655100 16437 0ustar00ollisgollisg000000000000File-BaseDir-0.09/t/libpackage Helper; use strict; use warnings; use File::Temp qw( tempdir ); use File::Path qw( mkpath ); use Test::More (); use Exporter qw( import ); our @EXPORT_OK = qw( build_test_data ); sub build_test_data { my $root = tempdir( CLEANUP => 1 ); my $dir = File::Spec->catdir($root, 't','data','dir'); Test::More::note "mkpath $dir"; mkpath($dir, 0, oct('0700')); foreach my $file (map { File::Spec->catfile($root, @$_) } ['t','data','test'], ['t','data','dir','test']) { Test::More::note "create $file"; open my $fh, '>', $file or die "unable to write $file $!"; print $fh "test 1 2 3\n"; close $fh; } $root; } 1; author000755001750001750 014071655100 15452 5ustar00ollisgollisg000000000000File-BaseDir-0.09/xteol.t100644001750001750 51014071655100 16532 0ustar00ollisgollisg000000000000File-BaseDir-0.09/xt/authoruse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::EOL' unless eval q{ use Test::EOL; 1 }; }; use Test::EOL; use FindBin; use File::Spec; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); all_perl_files_ok(grep { -e $_ } qw( bin lib t Makefile.PL )); pod.t100644001750001750 47214071655100 16544 0ustar00ollisgollisg000000000000File-BaseDir-0.09/xt/authoruse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::Pod' unless eval q{ use Test::Pod; 1 }; }; use Test::Pod; use FindBin; use File::Spec; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); all_pod_files_ok( grep { -e $_ } qw( bin lib )); 03_icontheme.t100644001750001750 132714071655100 16565 0ustar00ollisgollisg000000000000File-BaseDir-0.09/tuse strict; use warnings; use Test::More; use Config; use File::BaseDir; use File::IconTheme qw(xdg_icon_theme_search_dirs); use File::Spec; use File::Temp qw(); if ($^O eq 'MSWin32') { plan skip_all => 'File path comparisons cannot be made on MS Windows operating system.'; } else { plan tests => 1; } my @dirs = map {File::Temp->newdir} 0 .. 2; my @icondirs = map {File::Spec->catfile($_, 'icons')} @dirs; mkdir $_ for @icondirs; $ENV{XDG_DATA_HOME} = $dirs[0]; $ENV{XDG_DATA_DIRS} = $dirs[1] . $Config{path_sep} . $dirs[2]; is_deeply [xdg_icon_theme_search_dirs], [grep {-d $_ && -r $_} File::Spec->catfile(File::BaseDir->_home, '.icons'), @icondirs, '/usr/share/pixmaps' ]; critic.t100644001750001750 51614071655100 17236 0ustar00ollisgollisg000000000000File-BaseDir-0.09/xt/authoruse Test2::Require::Module 'Test2::Tools::PerlCritic'; use Test2::Require::Module 'Perl::Critic'; use Test2::Require::Module 'Perl::Critic::Community'; use Test2::V0; use Perl::Critic; use Test2::Tools::PerlCritic; my $critic = Perl::Critic->new( -profile => 'perlcriticrc', ); perl_critic_ok ['lib','t'], $critic; done_testing; strict.t100644001750001750 103114071655100 17302 0ustar00ollisgollisg000000000000File-BaseDir-0.09/xt/authoruse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::Strict' unless eval q{ use Test::Strict; 1 }; }; use Test::Strict; use FindBin; use File::Spec; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); unshift @Test::Strict::MODULES_ENABLING_STRICT, 'ozo', 'Test2::Bundle::SIPS', 'Test2::V0', 'Test2::Bundle::Extended'; note "enabling strict = $_" for @Test::Strict::MODULES_ENABLING_STRICT; all_perl_files_ok( grep { -e $_ } qw( bin lib t Makefile.PL )); release000755001750001750 014071655100 15570 5ustar00ollisgollisg000000000000File-BaseDir-0.09/xtfixme.t100644001750001750 61614071655100 17210 0ustar00ollisgollisg000000000000File-BaseDir-0.09/xt/releaseuse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::Fixme' unless eval q{ use Test::Fixme 0.14; 1 }; }; use Test::Fixme 0.07; use FindBin; use File::Spec; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); run_tests( match => qr/FIXME/, where => [ grep { -e $_ } qw( bin lib t Makefile.PL Build.PL )], warn => 1, ); File000755001750001750 014071655100 15142 5ustar00ollisgollisg000000000000File-BaseDir-0.09/libBaseDir.pm100644001750001750 2132514071655100 17174 0ustar00ollisgollisg000000000000File-BaseDir-0.09/lib/Filepackage File::BaseDir; use strict; use warnings; use Exporter 5.57 qw( import ); use File::Spec; use Config; # ABSTRACT: Use the Freedesktop.org base directory specification our $VERSION = '0.09'; # VERSION our %EXPORT_TAGS = ( vars => [ qw( xdg_data_home xdg_data_dirs xdg_config_home xdg_config_dirs xdg_cache_home ) ], lookup => [ qw( data_home data_dirs data_files config_home config_dirs config_files cache_home ) ], ); our @EXPORT_OK = ( qw(xdg_data_files xdg_config_files), map @$_, values %EXPORT_TAGS ); if($^O eq 'MSWin32') { *_rootdir = sub { 'C:\\' }; *_home = sub { $ENV{USERPROFILE} || $ENV{HOMEDRIVE}.$ENV{HOMEPATH} || 'C:\\' }; } else { *_rootdir = sub { File::Spec->rootdir }; *_home = sub { $ENV{HOME} || eval { [getpwuid($>)]->[7] } || File::Spec->rootdir }; } # OO method sub new { bless \$VERSION, shift } # what else is there to bless ? # Variable methods sub xdg_data_home { $ENV{XDG_DATA_HOME} || File::Spec->catdir(_home(), qw/.local share/) } sub xdg_data_dirs { ( $ENV{XDG_DATA_DIRS} ? _adapt($ENV{XDG_DATA_DIRS}) : (File::Spec->catdir(_rootdir(), qw/usr local share/), File::Spec->catdir(_rootdir(), qw/usr share/)) ) } sub xdg_config_home {$ENV{XDG_CONFIG_HOME} || File::Spec->catdir(_home(), '.config') } sub xdg_config_dirs { ( $ENV{XDG_CONFIG_DIRS} ? _adapt($ENV{XDG_CONFIG_DIRS}) : File::Spec->catdir(_rootdir(), qw/etc xdg/) ) } sub xdg_cache_home { $ENV{XDG_CACHE_HOME} || File::Spec->catdir(_home(), '.cache') } sub _adapt { map { File::Spec->catdir( split(/\//, $_) ) } split /\Q$Config{path_sep}\E/, shift; # ':' defined in the spec, but ';' is standard on win32 } # Lookup methods sub data_home { _catfile(xdg_data_home, @_) } sub data_dirs { _find_files(\&_dir, \@_, xdg_data_home, xdg_data_dirs) } sub data_files { _find_files(\&_file, \@_, xdg_data_home, xdg_data_dirs) } sub xdg_data_files { my @dirs = data_files(@_); return @dirs } sub config_home { _catfile(xdg_config_home, @_) } sub config_dirs { _find_files(\&_dir, \@_, xdg_config_home, xdg_config_dirs) } sub config_files { _find_files(\&_file, \@_, xdg_config_home, xdg_config_dirs) } sub xdg_config_files { my @dirs = config_files(@_); return @dirs } sub cache_home { _catfile(xdg_cache_home, @_) } sub _catfile { my $dir = shift; shift if ref $_[0] or $_[0] =~ /::/; # OO call return File::Spec->catfile($dir, @_); } sub _find_files { my $type = shift; my $file = shift; shift @$file if ref $$file[0] or $$file[0] =~ /::/; # OO call #warn "Looking for: @$file\n in: @_\n"; if (wantarray) { ## no critic (Community::Wantarray) return grep { &$type( $_ ) && -r $_ } map { File::Spec->catfile($_, @$file) } @_; } else { # prevent unnecessary stats by returning early for (@_) { my $path = File::Spec->catfile($_, @$file); return $path if &$type($path) && -r $path; } } return (); } sub _dir { -d $_[0] } sub _file { -f $_[0] } 1; __END__ =pod =encoding UTF-8 =head1 NAME File::BaseDir - Use the Freedesktop.org base directory specification =head1 VERSION version 0.09 =head1 SYNOPSIS use File::BaseDir qw/xdg_data_files/; for ( xdg_data_files('mime/globs') ) { # do something } =head1 DESCRIPTION This module can be used to find directories and files as specified by the Freedesktop.org Base Directory Specification. This specifications gives a mechanism to locate directories for configuration, application data and cache data. It is suggested that desktop applications for e.g. the GNOME, KDE or Xfce platforms follow this layout. However, the same layout can just as well be used for non-GUI applications. This module forked from L. This module follows version 0.6 of BaseDir specification. =head1 CONSTRUCTOR =head2 new my $bd = File::BaseDir->new; Simple constructor to allow calling functions as object oriented methods. =head1 FUNCTIONS None of these are exported by default, but all functions can be exported by request. Also the groups C<:lookup> and C<:vars> are defined. The C<:vars> group contains all the routines with a C prefix. The C<:lookup> group contains the routines to locate files and directories. =head2 data_home my $path = data_home(@path); my $path = $bd->data_home(@path); Takes a list of file path elements and returns a new path by appending them to the data home directory. The new path does not need to exist. Use this when writing user specific application data. Example: # data_home is: /home/USER/.local/share $path = $bd->data_home('Foo', 'Bar', 'Baz'); # returns: /home/USER/.local/share/Foo/Bar/Baz =head2 data_dirs # :lookup my $dir = data_dirs(@path); my $dir = $bd->data_dirs(@path); my @dirs = data_dirs(@path); my @dirs = $bd->data_dirs(@path); Looks for directories specified by C<@path> in the data home and other data directories. Returns (possibly empty) list of readable directories. In scalar context only the first directory found is returned. Use this to lookup application data. =head2 data_files # :lookup my $file = data_files(@path); my $file = $bd->data_files(@path); my @files = data_files(@path); my @files = $bd->data_files(@path); Looks for files specified by C<@path> in the data home and other data directories. Only returns files that are readable. In scalar context only the first file found is returned. Use this to lookup application data. =head2 config_home # :lookup my $dir = config_home(@path); my $dir = $bd->config_home(@path); Takes a list of path elements and appends them to the config home directory returning a new path. The new path does not need to exist. Use this when writing user specific configuration. =head2 config_dirs # :lookup my $dir = config_dirs(@path); my $dir = $bd->config_dirs(@path); my @dirs = config_dirs(@path); my @dirs = $bd->config_dirs(@path); Looks for directories specified by C<@path> in the config home and other config directories. Returns (possibly empty) list of readable directories. In scalar context only the first directory found is returned. Use this to lookup configuration. =head2 config_files # :lookup my $file = config_files(@path); my $file = $bd->config_files(@path); my @files = config_files(@path); my @files = $bd->config_files(@path); Looks for files specified by C<@path> in the config home and other config directories. Returns a (possibly empty) list of files that are readable. In scalar context only the first file found is returned. Use this to lookup configuration. =head2 cache_home # :lookup my $dir = cache_home(@path); my $dir = $bd->cache_home(@path); Takes a list of path elements and appends them to the cache home directory returning a new path. The new path does not need to exist. =head2 xdg_data_home # :var my $dir = xdg_data_home; my $dir = $bd->xdg_data_home; Returns either C<$ENV{XDG_DATA_HOME}> or it's default value. Default is F<$HOME/.local/share>. =head2 xdg_data_dirs # :var my @dirs = xdg_data_dirs; my @dirs = $bd->xdg_data_dirs; Returns either C<$ENV{XDG_DATA_DIRS}> or it's default value as list. Default is F, F. =head2 xdg_config_home # :var my $dir = xdg_config_home; my $dir = $bd->xdg_config_home; Returns either C<$ENV{XDG_CONFIG_HOME}> or it's default value. Default is F<$HOME/.config>. =head2 xdg_config_dirs # :var my @dirs = xdg_config_dirs; my @dirs = $bd->xdg_config_dirs; Returns either C<$ENV{XDG_CONFIG_DIRS}> or it's default value as list. Default is F. =head2 xdg_cache_home # :var my $dir = xdg_cache_home; my $dir = $bd->xdg_cache_home; Returns either C<$ENV{XDG_CACHE_HOME}> or it's default value. Default is F<$HOME/.cache>. =head1 NON-UNIX PLATFORMS The use of L ensures that all paths are returned in their native formats regardless of platform. On Windows this module will use the native environment variables, rather than the default on UNIX (which is traditionally C<$HOME>). Please note that the specification is targeting Unix platforms only and will only have limited relevance on other platforms. Any platform dependent behavior in this module should be considered an extension of the spec. =head1 BACKWARDS COMPATIBILITY The methods C and C are exported for backwards compatibility with version 0.02. They are identical to C and C respectively but without the C behavior. =head1 AUTHORS =over 4 =item * Jaap Karssenberg || Pardus [Larus] =item * Graham Ollis =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2003-2021 by Jaap Karssenberg || Pardus [Larus] . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut no_tabs.t100644001750001750 52214071655100 17403 0ustar00ollisgollisg000000000000File-BaseDir-0.09/xt/authoruse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::NoTabs' unless eval q{ use Test::NoTabs; 1 }; }; use Test::NoTabs; use FindBin; use File::Spec; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); all_perl_files_ok( grep { -e $_ } qw( bin lib t Makefile.PL )); version.t100644001750001750 147314071655100 17471 0ustar00ollisgollisg000000000000File-BaseDir-0.09/xt/authoruse strict; use warnings; use Test::More; use FindBin (); BEGIN { plan skip_all => "test requires Test::Version 2.00" unless eval q{ use Test::Version 2.00 qw( version_all_ok ), { has_version => 1, filename_match => sub { $_[0] !~ m{/(ConfigData|Install/Files)\.pm$} }, }; 1 }; plan skip_all => 'test requires YAML' unless eval q{ use YAML; 1; }; } use YAML qw( LoadFile ); use FindBin; use File::Spec; my $config_filename = File::Spec->catfile( $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml' ); my $config; $config = LoadFile($config_filename) if -r $config_filename; if($config->{version}->{dir}) { note "using dir " . $config->{version}->{dir} } version_all_ok($config->{version}->{dir} ? ($config->{version}->{dir}) : ()); done_testing; UserDirs.pm100644001750001750 1026014071655100 17417 0ustar00ollisgollisg000000000000File-BaseDir-0.09/lib/Filepackage File::UserDirs; use strict; use warnings; use IPC::System::Simple qw(capturex); use Exporter 5.57 qw( import ); # ABSTRACT: Find extra media and documents directories our $VERSION = '0.09'; # VERSION our %EXPORT_TAGS = ( all => [ qw(xdg_desktop_dir xdg_documents_dir xdg_download_dir xdg_music_dir xdg_pictures_dir xdg_publicshare_dir xdg_templates_dir xdg_videos_dir) ]); our @EXPORT_OK = @{$EXPORT_TAGS{all}}; sub _xdg_user_dir { my ($purpose) = @_; my $dir = capturex 'xdg-user-dir', $purpose; chomp $dir; return $dir; } sub xdg_desktop_dir {return _xdg_user_dir 'DESKTOP';} sub xdg_documents_dir {return _xdg_user_dir 'DOCUMENTS';} sub xdg_download_dir {return _xdg_user_dir 'DOWNLOAD';} sub xdg_music_dir {return _xdg_user_dir 'MUSIC';} sub xdg_pictures_dir {return _xdg_user_dir 'PICTURES';} sub xdg_publicshare_dir {return _xdg_user_dir 'PUBLICSHARE';} sub xdg_templates_dir {return _xdg_user_dir 'TEMPLATES';} sub xdg_videos_dir {return _xdg_user_dir 'VIDEOS';} 1; __END__ =pod =encoding UTF-8 =head1 NAME File::UserDirs - Find extra media and documents directories =head1 VERSION version 0.09 =head1 SYNOPSIS use File::UserDirs qw(:all); print xdg_desktop_dir; # e.g. /home/user/Desktop =head1 DESCRIPTION This module can be used to find directories as informally specified by the Freedesktop.org xdg-user-dirs software. This gives a mechanism to locate extra directories for media and documents files. =head1 FUNCTIONS May be exported on request. Also the group C<:all> is defined which exports all methods. =head2 xdg_desktop_dir my $dir = xdg_desktop_dir; Returns the desktop directory. Unless changed by the user, this is the directory F in the home directory. =head2 xdg_documents_dir my $dir = xdg_documents_dir; Returns the documents directory. Unless changed by the user, this is the home directory. =head2 xdg_download_dir my $dir = xdg_download_dir; Returns the download directory. Unless changed by the user, this is the home directory. =head2 xdg_music_dir my $dir = xdg_music_dir; Returns the music directory. Unless changed by the user, this is the home directory. =head2 xdg_pictures_dir my $dir = xdg_pictures_dir; Returns the pictures directory. Unless changed by the user, this is the home directory. =head2 xdg_publicshare_dir my $dir = xdg_publicshare_dir; Returns the public share directory. Unless changed by the user, this is the home directory. =head2 xdg_templates_dir my $dir = xdg_templates_dir; Returns the templates directory. Unless changed by the user, this is the home directory. =head2 xdg_videos_dir my $dir = xdg_videos_dir; Returns the videos directory. Unless changed by the user, this is the home directory. =head1 DIAGNOSTICS =over =item C<"xdg-user-dir" failed to start: %s> The executable C could not be run, most likely because it was not installed. See L. =back =head1 CONFIGURATION AND ENVIRONMENT The location of the directories can be specified by the user in the file F<$XDG_CONFIG_HOME/user-dirs.dirs>. It is a shell file setting a number of environment variables. To find the exact pathname from Perl, run: use File::BaseDir qw(config_home); print config_home('user-dirs.dirs'); =head2 Example customised F XDG_DESKTOP_DIR="$HOME/Workspace" XDG_DOCUMENTS_DIR="$HOME/Files" XDG_DOWNLOAD_DIR="$HOME/Files/Downloads" XDG_MUSIC_DIR="$HOME/Files/Audio" XDG_PICTURES_DIR="$HOME/Files/Images" XDG_PUBLICSHARE_DIR="$HOME/public_html" XDG_TEMPLATES_DIR="$HOME/Files/Document templates" XDG_VIDEOS_DIR="$HOME/Files/Video" =head1 DEPENDENCIES This module requires the executable F from the package C. Source code is available from L. =head1 AUTHORS =over 4 =item * Jaap Karssenberg || Pardus [Larus] =item * Graham Ollis =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2003-2021 by Jaap Karssenberg || Pardus [Larus] . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut IconTheme.pm100644001750001750 334514071655100 17520 0ustar00ollisgollisg000000000000File-BaseDir-0.09/lib/Filepackage File::IconTheme; use strict; use warnings; use File::BaseDir qw(data_dirs); use File::Spec; use Exporter 5.57 qw( import ); # ABSTRACT: Find icon directories our $VERSION = '0.09'; # VERSION our @EXPORT_OK = qw(xdg_icon_theme_search_dirs); sub xdg_icon_theme_search_dirs { return grep {-d $_ && -r $_} File::Spec->catfile(File::BaseDir->_home, '.icons'), data_dirs('icons'), '/usr/share/pixmaps'; } 1; __END__ =pod =encoding UTF-8 =head1 NAME File::IconTheme - Find icon directories =head1 VERSION version 0.09 =head1 SYNOPSIS use File::IconTheme qw(xdg_icon_theme_search_dirs); print join "\n", xdg_icon_theme_search_dirs; =head1 DESCRIPTION This module can be used to find directories as specified by the Freedesktop.org Icon Theme Specification. Currently only a tiny (but most useful) part of the specification is implemented. In case you want to B an icon theme, use the directory returned by: use File::BaseDir qw(data_dirs); print scalar data_dirs('icons'); =head1 FUNCTIONS Can be exported on request. =head2 xdg_icon_theme_search_dirs my @dirs = xdg_icon_theme_search_dir; Returns a list of the base directories of icon themes. =head1 CONFIGURATION AND ENVIRONMENT C<$XDG_DATA_HOME>, C<$XDG_DATA_DIRS> =head1 SEE ALSO L =head1 AUTHORS =over 4 =item * Jaap Karssenberg || Pardus [Larus] =item * Graham Ollis =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2003-2021 by Jaap Karssenberg || Pardus [Larus] . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut pod_coverage.t100644001750001750 400114071655100 20427 0ustar00ollisgollisg000000000000File-BaseDir-0.09/xt/authoruse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires 5.010 or better' unless $] >= 5.010; plan skip_all => 'test requires Test::Pod::Coverage' unless eval q{ use Test::Pod::Coverage; 1 }; plan skip_all => 'test requires YAML' unless eval q{ use YAML; 1; }; plan skip_all => 'test does not always work in cip check' if defined $ENV{CIPSTATIC} && $ENV{CIPSTATIC} eq 'true'; }; use Test::Pod::Coverage; use YAML qw( LoadFile ); use FindBin; use File::Spec; my $config_filename = File::Spec->catfile( $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml' ); my $config; $config = LoadFile($config_filename) if -r $config_filename; plan skip_all => 'disabled' if $config->{pod_coverage}->{skip}; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); my @private_classes; my %private_methods; push $config->{pod_coverage}->{private}->@*, 'Alien::.*::Install::Files#Inline'; foreach my $private ($config->{pod_coverage}->{private}->@*) { my($class,$method) = split /#/, $private; if(defined $class && $class ne '') { my $regex = eval 'qr{^' . $class . '$}'; if(defined $method && $method ne '') { push @private_classes, { regex => $regex, method => $method }; } else { push @private_classes, { regex => $regex, all => 1 }; } } elsif(defined $method && $method ne '') { $private_methods{$_} = 1 for split /,/, $method; } } my @classes = all_modules; plan tests => scalar @classes; foreach my $class (@classes) { SKIP: { my($is_private_class) = map { 1 } grep { $class =~ $_->{regex} && $_->{all} } @private_classes; skip "private class: $class", 1 if $is_private_class; my %methods = map {; $_ => 1 } map { split /,/, $_->{method} } grep { $class =~ $_->{regex} } @private_classes; $methods{$_} = 1 for keys %private_methods; my $also_private = eval 'qr{^' . join('|', keys %methods ) . '$}'; pod_coverage_ok $class, { also_private => [$also_private] }; }; } pod_spelling_common.t100644001750001750 135014071655100 22025 0ustar00ollisgollisg000000000000File-BaseDir-0.09/xt/authoruse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::Pod::Spelling::CommonMistakes' unless eval q{ use Test::Pod::Spelling::CommonMistakes; 1 }; plan skip_all => 'test requires YAML' unless eval q{ use YAML qw( LoadFile ); 1 }; }; use Test::Pod::Spelling::CommonMistakes; use FindBin; use File::Spec; my $config_filename = File::Spec->catfile( $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml' ); my $config; $config = LoadFile($config_filename) if -r $config_filename; plan skip_all => 'disabled' if $config->{pod_spelling_common}->{skip}; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); # TODO: test files in bin too. all_pod_files_ok; pod_spelling_system.t100644001750001750 236714071655100 22072 0ustar00ollisgollisg000000000000File-BaseDir-0.09/xt/authoruse strict; use warnings; use Test::More; BEGIN { plan skip_all => 'test requires Test::Spelling' unless eval q{ use Test::Spelling; 1 }; plan skip_all => 'test requires YAML' unless eval q{ use YAML; 1; }; }; use Test::Spelling; use YAML qw( LoadFile ); use FindBin; use File::Spec; my $config_filename = File::Spec->catfile( $FindBin::Bin, File::Spec->updir, File::Spec->updir, 'author.yml' ); my $config; $config = LoadFile($config_filename) if -r $config_filename; plan skip_all => 'disabled' if $config->{pod_spelling_system}->{skip}; chdir(File::Spec->catdir($FindBin::Bin, File::Spec->updir, File::Spec->updir)); add_stopwords($config->{pod_spelling_system}->{stopwords}->@*); add_stopwords(qw( Plicease stdout stderr stdin subref loopback username os Ollis Mojolicious plicease CPAN reinstall TODO filename filenames login callback callbacks standalone VMS hostname hostnames TCP UDP IP API MSWin32 OpenBSD FreeBSD NetBSD unencrypted WebSocket WebSockets timestamp timestamps poney BackPAN portably RedHat AIX BSD XS FFI perlish optimizations subdirectory RESTful SQLite JavaScript dir plugins munge jQuery namespace PDF PDFs usernames DBI pluggable APIs SSL JSON YAML uncommented Solaris OpenVMS URI URL CGI )); all_pod_files_spelling_ok;