File-ShareDir-1.104/000755 000765 000024 00000000000 13125201535 014034 5ustar00snostaff000000 000000 File-ShareDir-1.104/Changes000644 000765 000024 00000003231 13125201270 015322 0ustar00snostaff000000 000000 Revision history for Perl extension File-ShareDir 1.104 2017-06-29 - Fix RT#120833: Fails tests when no "." in @INC reported by Kent Fredric . - avoid tracking bundled prereqs - use inc::latest tooling from List::MoreUtils... - bundle reasonable LICENSE file and README.md 1.102 2014-05-12 - Fix RT#95572 "necessary test files not copied into blib" Thanks to Graham Knop for fixing and Zefram for reporting - Explicitely require warnings as runtime prerequisite Thanks to Graham Knop for reporting 1.101 2014-05-10 - Reformat Changes according to CPAN::Changes::Spec - Switch to EU::MM - fix RT#95401 (Thanks, Dolmen) - Taking Maintainership (Jens Rehsack, thanks to David Golden) 1.03 2010-02-01 - Upgraded to Module::Install 1.00 1.02 2010-05-18 - Upgraded to Module::Install 0.95 - Removed Params::Util dep (MIYAGAWA) 1.01 2009-11-24 - Updating Module::Install to 0.91 - Fix typo in documentation (Thanks, ribasushi) 1.00 2009-07-17 - Everything appears ok, release prod 0.99_01 2009-07-10 - Updating tests a little - Adding the class_file function - Allow *_file to find any kind of path, not just files (hdp) - Localising $@ during evals - Implementing the new sharedir model 0.05 2006-09-04 - Upgrading to Module::Install 0.64 0.04 2006-05-09 - Made module_dir work properly under MSWin32 (ishigaki) 0.03 2006-12-27 - Upgraded to Module::Install 0.55 - Added an additional test case for a bug(sort of) in 0.54 0.02 2005-12-11 - Made dist_file work properly with Module::Install::Share 0.01 2005-12-10 - First implementation File-ShareDir-1.104/foo/000755 000765 000024 00000000000 13125201535 014617 5ustar00snostaff000000 000000 File-ShareDir-1.104/inc/000755 000765 000024 00000000000 13125201535 014605 5ustar00snostaff000000 000000 File-ShareDir-1.104/lib/000755 000765 000024 00000000000 13125201535 014602 5ustar00snostaff000000 000000 File-ShareDir-1.104/LICENSE000644 000765 000024 00000043670 13125201270 015047 0ustar00snostaff000000 000000 This software is copyright (c) 2005 - 2011 Adam Kennedy. 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) 2005 - 2011 Adam Kennedy. 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) 2005 - 2011 Adam Kennedy. 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 File-ShareDir-1.104/Makefile.PL000644 000765 000024 00000011507 13071451633 016020 0ustar00snostaff000000 000000 use strict; use warnings; use ExtUtils::MakeMaker; BEGIN { unless (grep { $_ eq "." } @INC) { use lib "."; } } use inc::latest 'File::ShareDir::Install'; File::ShareDir::Install->import('0.03', 'install_share'); if (inc::latest->can("write")) { inc::latest->write("inc"); for my $mod (inc::latest->loaded_modules) { inc::latest->bundle_module($mod, "inc"); } } install_share 'share'; # Full version install_share module => 'File::ShareDir' => 'foo'; my %RUN_DEPS = ( 'warnings' => 0, 'Carp' => 0, 'Class::Inspector' => '1.12', 'File::Spec' => '0.80', ); my %BUILD_DEPS = ( 'ExtUtils::MakeMaker' => 0, 'File::ShareDir::Install' => '0.03' ); my %BUNDLE_CONFIGURE_DEPS = ( 'inc::latest' => '0.500', 'File::ShareDir::Install' => '0.08', ); my %TEST_DEPS = ( 'Test::More' => 0.90, ); WriteMakefile1( MIN_PERL_VERSION => '5.008001', META_ADD => { 'meta-spec' => {version => 2}, resources => { homepage => 'https://metacpan.org/release/File-ShareDir', repository => { url => 'git@github.com:perl5-utils/File-ShareDir.git', web => 'https://github.com/perl5-utils/File-ShareDir', type => 'git', }, bugtracker => { web => 'http://rt.cpan.org/Public/Dist/Display.html?Name=File-ShareDir', mailto => 'file-sharedir@rt.cpan.org', }, }, prereqs => { develop => { requires => { 'Test::CPAN::Changes' => 0, 'Test::CheckManifest' => 0, 'Test::Pod' => 0, 'Test::Pod::Coverage' => 0, 'Test::Pod::Spelling::CommonMistakes' => 0, %BUNDLE_CONFIGURE_DEPS, }, }, configure => { requires => {%BUILD_DEPS}, recommends => {%BUNDLE_CONFIGURE_DEPS} }, build => {requires => {%BUILD_DEPS}}, test => {requires => {%TEST_DEPS}}, runtime => { requires => {%RUN_DEPS}, }, }, }, NAME => 'File::ShareDir', VERSION_FROM => 'lib/File/ShareDir.pm', ABSTRACT_FROM => 'lib/File/ShareDir.pm', LICENSE => 'perl', AUTHOR => q{Adam Kennedy }, PREREQ_PM => \%RUN_DEPS, BUILD_REQUIRES => \%BUILD_DEPS, TEST_REQUIRES => \%TEST_DEPS, (-d "xt" ? (realclean => {FILES => "inc/latest* inc/inc_* t/xs"}) : ()), test => {TESTS => 't/*.t xt/*.t'}, ); sub WriteMakefile1 { # originally written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade. my %params = @_; my $eumm_version = $ExtUtils::MakeMaker::VERSION; $eumm_version = eval $eumm_version; die "EXTRA_META is deprecated" if (exists($params{EXTRA_META})); die "License not specified" if (!exists($params{LICENSE})); if ($params{TEST_REQUIRES} and ($eumm_version < 6.6303)) { if ($params{BUILD_REQUIRES}) { $params{BUILD_REQUIRES} = {%{$params{BUILD_REQUIRES}}, %{$params{TEST_REQUIRES}}}; } else { $params{BUILD_REQUIRES} = delete $params{TEST_REQUIRES}; } } if ($params{BUILD_REQUIRES} and ($eumm_version < 6.5503)) { #EUMM 6.5502 has problems with BUILD_REQUIRES $params{PREREQ_PM} = {%{$params{PREREQ_PM} || {}}, %{$params{BUILD_REQUIRES}}}; delete $params{BUILD_REQUIRES}; } delete $params{CONFIGURE_REQUIRES} if ($eumm_version < 6.52); delete $params{MIN_PERL_VERSION} if ($eumm_version < 6.48); delete $params{META_MERGE} if ($eumm_version < 6.46); delete $params{META_ADD}{prereqs} if ($eumm_version < 6.58); delete $params{META_ADD}{'meta-spec'} if ($eumm_version < 6.58); delete $params{META_ADD} if ($eumm_version < 6.46); delete $params{LICENSE} if ($eumm_version < 6.31); delete $params{AUTHOR} if ($] < 5.005); delete $params{ABSTRACT_FROM} if ($] < 5.005); delete $params{BINARY_LOCATION} if ($] < 5.005); # more or less taken from Moose' Makefile.PL if ($params{CONFLICTS}) { my $ok = CheckConflicts(%params); exit(0) if ($params{PREREQ_FATAL} and not $ok); my $cpan_smoker = grep { $_ =~ m/(?:CR_SMOKER|CPAN_REPORTER|AUTOMATED_TESTING)/ } keys %ENV; unless ($cpan_smoker || $ENV{PERL_MM_USE_DEFAULT}) { sleep 4 unless ($ok); } delete $params{CONFLICTS}; } WriteMakefile(%params); } package MY; use File::ShareDir::Install qw(postamble); 1; File-ShareDir-1.104/MANIFEST000644 000765 000024 00000000657 13125201535 015175 0ustar00snostaff000000 000000 Changes foo/test_file.txt inc/inc_File-ShareDir-Install/File/ShareDir/Install.pm inc/latest.pm inc/latest/private.pm lib/File/ShareDir.pm LICENSE Makefile.PL MANIFEST README.md share/sample.txt share/subdir/sample.txt t/01_compile.t t/02_main.t t/lib/ShareDir.pm META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) File-ShareDir-1.104/META.json000644 000765 000024 00000004060 13125201535 015455 0ustar00snostaff000000 000000 { "abstract" : "Locate per-dist and per-module shared files", "author" : [ "Adam Kennedy " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "File-ShareDir", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0", "File::ShareDir::Install" : "0.03" } }, "configure" : { "recommends" : { "File::ShareDir::Install" : "0.08", "inc::latest" : "0.500" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::ShareDir::Install" : "0.03" } }, "develop" : { "requires" : { "File::ShareDir::Install" : "0.08", "Test::CPAN::Changes" : "0", "Test::CheckManifest" : "0", "Test::Pod" : "0", "Test::Pod::Coverage" : "0", "Test::Pod::Spelling::CommonMistakes" : "0", "inc::latest" : "0.500" } }, "runtime" : { "requires" : { "Carp" : "0", "Class::Inspector" : "1.12", "File::Spec" : "0.80", "warnings" : "0" } }, "test" : { "requires" : { "Test::More" : "0.9" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "file-sharedir@rt.cpan.org", "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=File-ShareDir" }, "homepage" : "https://metacpan.org/release/File-ShareDir", "repository" : { "type" : "git", "web" : "https://github.com/perl5-utils/File-ShareDir" } }, "version" : "1.104", "x_serialization_backend" : "JSON::PP version 2.27400_02" } File-ShareDir-1.104/META.yml000644 000765 000024 00000001626 13125201535 015312 0ustar00snostaff000000 000000 --- abstract: 'Locate per-dist and per-module shared files' author: - 'Adam Kennedy ' build_requires: ExtUtils::MakeMaker: '0' File::ShareDir::Install: '0.03' Test::More: '0.9' configure_requires: ExtUtils::MakeMaker: '0' File::ShareDir::Install: '0.03' dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 7.24, 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-ShareDir no_index: directory: - t - inc requires: Carp: '0' Class::Inspector: '1.12' File::Spec: '0.80' warnings: '0' resources: bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=File-ShareDir homepage: https://metacpan.org/release/File-ShareDir repository: https://github.com/perl5-utils/File-ShareDir version: '1.104' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' File-ShareDir-1.104/README.md000644 000765 000024 00000017032 13125201270 015312 0ustar00snostaff000000 000000 # NAME File::ShareDir - Locate per-dist and per-module shared files # SYNOPSIS use File::ShareDir ':ALL'; # Where are distribution-level shared data files kept $dir = dist_dir('File-ShareDir'); # Where are module-level shared data files kept $dir = module_dir('File::ShareDir'); # Find a specific file in our dist/module shared dir $file = dist_file( 'File-ShareDir', 'file/name.txt'); $file = module_file('File::ShareDir', 'file/name.txt'); # Like module_file, but search up the inheritance tree $file = class_file( 'Foo::Bar', 'file/name.txt' ); # DESCRIPTION The intent of [File::ShareDir](https://metacpan.org/pod/File::ShareDir) is to provide a companion to [Class::Inspector](https://metacpan.org/pod/Class::Inspector) and [File::HomeDir](https://metacpan.org/pod/File::HomeDir), modules that take a process that is well-known by advanced Perl developers but gets a little tricky, and make it more available to the larger Perl community. Quite often you want or need your Perl module (CPAN or otherwise) to have access to a large amount of read-only data that is stored on the file-system at run-time. On a linux-like system, this would be in a place such as /usr/share, however Perl runs on a wide variety of different systems, and so the use of any one location is unreliable. Perl provides a little-known method for doing this, but almost nobody is aware that it exists. As a result, module authors often go through some very strange ways to make the data available to their code. The most common of these is to dump the data out to an enormous Perl data structure and save it into the module itself. The result are enormous multi-megabyte .pm files that chew up a lot of memory needlessly. Another method is to put the data "file" after the \_\_DATA\_\_ compiler tag and limit yourself to access as a filehandle. The problem to solve is really quite simple. 1. Write the data files to the system at install time. 2. Know where you put them at run-time. Perl's install system creates an "auto" directory for both every distribution and for every module file. These are used by a couple of different auto-loading systems to store code fragments generated at install time, and various other modules written by the Perl "ancient masters". But the same mechanism is available to any dist or module to store any sort of data. ## Using Data in your Module `File::ShareDir` forms one half of a two part solution. Once the files have been installed to the correct directory, you can use `File::ShareDir` to find your files again after the installation. For the installation half of the solution, see [Module::Install](https://metacpan.org/pod/Module::Install) and its `install_share` directive. # FUNCTIONS `File::ShareDir` provides four functions for locating files and directories. For greater maintainability, none of these are exported by default and you are expected to name the ones you want at use-time, or provide the `':ALL'` tag. All of the following are equivalent. # Load but don't import, and then call directly use File::ShareDir; $dir = File::ShareDir::dist_dir('My-Dist'); # Import a single function use File::ShareDir 'dist_dir'; dist_dir('My-Dist'); # Import all the functions use File::ShareDir ':ALL'; dist_dir('My-Dist'); All of the functions will check for you that the dir/file actually exists, and that you have read permissions, or they will throw an exception. ## dist\_dir # Get a distribution's shared files directory my $dir = dist_dir('My-Distribution'); The `dist_dir` function takes a single parameter of the name of an installed (CPAN or otherwise) distribution, and locates the shared data directory created at install time for it. Returns the directory path as a string, or dies if it cannot be located or is not readable. ## module\_dir # Get a module's shared files directory my $dir = module_dir('My::Module'); The `module_dir` function takes a single parameter of the name of an installed (CPAN or otherwise) module, and locates the shared data directory created at install time for it. In order to find the directory, the module **must** be loaded when calling this function. Returns the directory path as a string, or dies if it cannot be located or is not readable. ## dist\_file # Find a file in our distribution shared dir my $dir = dist_file('My-Distribution', 'file/name.txt'); The `dist_file` function takes two params of the distribution name and file name, locates the dist dir, and then finds the file within it, verifying that the file actually exists, and that it is readable. The filename should be a relative path in the format of your local filesystem. It will simply added to the directory using [File::Spec](https://metacpan.org/pod/File::Spec)'s `catfile` method. Returns the file path as a string, or dies if the file or the dist's directory cannot be located, or the file is not readable. ## module\_file # Find a file in our module shared dir my $dir = module_file('My::Module', 'file/name.txt'); The `module_file` function takes two params of the module name and file name. It locates the module dir, and then finds the file within it, verifying that the file actually exists, and that it is readable. In order to find the directory, the module **must** be loaded when calling this function. The filename should be a relative path in the format of your local filesystem. It will simply added to the directory using [File::Spec](https://metacpan.org/pod/File::Spec)'s `catfile` method. Returns the file path as a string, or dies if the file or the dist's directory cannot be located, or the file is not readable. ## class\_file # Find a file in our module shared dir, or in our parent class my $dir = class_file('My::Module', 'file/name.txt'); The `module_file` function takes two params of the module name and file name. It locates the module dir, and then finds the file within it, verifying that the file actually exists, and that it is readable. In order to find the directory, the module **must** be loaded when calling this function. The filename should be a relative path in the format of your local filesystem. It will simply added to the directory using [File::Spec](https://metacpan.org/pod/File::Spec)'s `catfile` method. If the file is NOT found for that module, `class_file` will scan up the module's @ISA tree, looking for the file in all of the parent classes. This allows you to, in effect, "subclass" shared files. Returns the file path as a string, or dies if the file or the dist's directory cannot be located, or the file is not readable. # SUPPORT Bugs should always be submitted via the CPAN bug tracker [http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-ShareDir](http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-ShareDir) For other issues, contact the maintainer. # AUTHOR Adam Kennedy <adamk@cpan.org> # SEE ALSO [File::ShareDir::Install](https://metacpan.org/pod/File::ShareDir::Install), [File::HomeDir](https://metacpan.org/pod/File::HomeDir), [Module::Install](https://metacpan.org/pod/Module::Install), [Module::Install::Share](https://metacpan.org/pod/Module::Install::Share), [File::ShareDir::PAR](https://metacpan.org/pod/File::ShareDir::PAR), [Dist::Zilla::Plugin::ShareDir](https://metacpan.org/pod/Dist::Zilla::Plugin::ShareDir) # COPYRIGHT Copyright 2005 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. File-ShareDir-1.104/share/000755 000765 000024 00000000000 13125201535 015136 5ustar00snostaff000000 000000 File-ShareDir-1.104/t/000755 000765 000024 00000000000 13125201535 014277 5ustar00snostaff000000 000000 File-ShareDir-1.104/t/01_compile.t000755 000765 000024 00000000317 12333436310 016421 0ustar00snostaff000000 000000 #!/usr/bin/perl # Compile-testing for File::ShareDir use strict; BEGIN { $| = 1; $^W = 1; } use Test::More tests => 2; ok( $] > 5.005, 'Perl version is 5.005 or newer' ); use_ok( 'File::ShareDir' ); File-ShareDir-1.104/t/02_main.t000755 000765 000024 00000006461 13071464417 015735 0ustar00snostaff000000 000000 #!/usr/bin/perl # Compile-testing for File::ShareDir use strict; BEGIN { $| = 1; $^W = 1; } use Test::More tests => 31; use File::ShareDir; sub dies { my $code = shift; my $message = shift || 'Code dies as expected'; my $rv = eval { &$code() }; ok( $@, $message ); } # Print the contents of @INC #diag("\@INC = qw{"); #foreach ( @INC ) { # diag(" $_"); #} #diag(" }"); ##################################################################### # Loading and Importing # Don't import by default ok( ! defined &dist_dir, 'dist_dir not imported by default' ); ok( ! defined &module_dir, 'module_dir not imported by default' ); ok( ! defined &dist_file, 'dist_file not imported by default' ); ok( ! defined &module_file, 'module_file not imported by default' ); ok( ! defined &class_file, 'class_file not imported by default' ); use_ok( 'File::ShareDir', ':ALL' ); # Import as needed ok( defined &dist_dir, 'dist_dir imported' ); ok( defined &module_dir, 'module_dir imported' ); ok( defined &dist_file, 'dist_file imported' ); ok( defined &module_file, 'module_file imported' ); ok( defined &class_file, 'class_file imported' ); # Allow all named functions use_ok( 'File::ShareDir', 'module_dir', 'module_file', 'dist_dir', 'dist_file', 'class_file', ); ##################################################################### # Support Methods is( File::ShareDir::_MODULE('File::ShareDir'), 'File::ShareDir', '_MODULE returns correct for known loaded module', ); is( File::ShareDir::_DIST('File-ShareDir'), 'File-ShareDir', '_DIST returns correct for known good dist', ); ##################################################################### # Module Tests my $module_dir = module_dir('File::ShareDir'); ok( $module_dir, 'Can find our own module dir' ); ok( -d $module_dir, '... and is a dir' ); ok( -r $module_dir, '... and have read permissions' ); dies( sub { module_dir() }, 'No params to module_dir dies' ); dies( sub { module_dir('') }, 'Null param to module_dir dies' ); dies( sub { module_dir('File::ShareDir::Bad') }, 'Getting module dir for known non-existanct module dies', ); my $module_file = module_file('File::ShareDir', 'test_file.txt'); ok( -f $module_file, 'module_file ok' ); ##################################################################### # Distribution Tests my $dist_dir = dist_dir('File-ShareDir'); ok( $dist_dir, 'Can find our own dist dir' ); ok( -d $dist_dir, '... and is a dir' ); ok( -r $dist_dir, '... and have read permissions' ); my $dist_file = dist_file('File-ShareDir', 'sample.txt'); ok( $dist_file, 'Can find our sample module file' ); ok( -f $dist_file, '... and is a file' ); ok( -r $dist_file, '... and have read permissions' ); # Make sure the directory in dist_dir, matches the one from dist_file # Bug found in Module::Install 0.54, fixed in 0.55 is( File::Spec->catfile($dist_dir, 'sample.txt'), $dist_file, 'dist_dir and dist_file find the same directory', ); ##################################################################### # Class Tests { local @INC; push @INC, "." unless grep { $_ eq "." } @INC; use_ok( "t::lib::ShareDir" ); } my $class_file = class_file('t::lib::ShareDir', 'test_file.txt'); ok( -f $class_file, 'class_file ok' ); is( $class_file, $module_file, 'class_file matches module_file for subclass' ); File-ShareDir-1.104/t/lib/000755 000765 000024 00000000000 13125201535 015045 5ustar00snostaff000000 000000 File-ShareDir-1.104/t/lib/ShareDir.pm000644 000765 000024 00000000204 12333436310 017101 0ustar00snostaff000000 000000 package t::lib::ShareDir; use strict; use vars qw{$VERSION @ISA}; BEGIN { $VERSION = '1.01'; @ISA = 'File::ShareDir'; } 1; File-ShareDir-1.104/share/sample.txt000755 000765 000024 00000000237 12333436310 017166 0ustar00snostaff000000 000000 This is a sample shared file. You should be able to locate it using the following use File::ShareDir (); module_file('File::ShareDir', 'sample.txt'); File-ShareDir-1.104/share/subdir/000755 000765 000024 00000000000 13125201535 016426 5ustar00snostaff000000 000000 File-ShareDir-1.104/share/subdir/sample.txt000755 000765 000024 00000000246 12333436310 020456 0ustar00snostaff000000 000000 This is a sample shared file. You should be able to locate it using the following use File::ShareDir (); module_file('File::ShareDir', 'subdir/sample.txt'); File-ShareDir-1.104/lib/File/000755 000765 000024 00000000000 13125201535 015461 5ustar00snostaff000000 000000 File-ShareDir-1.104/lib/File/ShareDir.pm000755 000765 000024 00000034321 13071464417 017540 0ustar00snostaff000000 000000 package File::ShareDir; =pod =head1 NAME File::ShareDir - Locate per-dist and per-module shared files =head1 SYNOPSIS use File::ShareDir ':ALL'; # Where are distribution-level shared data files kept $dir = dist_dir('File-ShareDir'); # Where are module-level shared data files kept $dir = module_dir('File::ShareDir'); # Find a specific file in our dist/module shared dir $file = dist_file( 'File-ShareDir', 'file/name.txt'); $file = module_file('File::ShareDir', 'file/name.txt'); # Like module_file, but search up the inheritance tree $file = class_file( 'Foo::Bar', 'file/name.txt' ); =head1 DESCRIPTION The intent of L is to provide a companion to L and L, modules that take a process that is well-known by advanced Perl developers but gets a little tricky, and make it more available to the larger Perl community. Quite often you want or need your Perl module (CPAN or otherwise) to have access to a large amount of read-only data that is stored on the file-system at run-time. On a linux-like system, this would be in a place such as /usr/share, however Perl runs on a wide variety of different systems, and so the use of any one location is unreliable. Perl provides a little-known method for doing this, but almost nobody is aware that it exists. As a result, module authors often go through some very strange ways to make the data available to their code. The most common of these is to dump the data out to an enormous Perl data structure and save it into the module itself. The result are enormous multi-megabyte .pm files that chew up a lot of memory needlessly. Another method is to put the data "file" after the __DATA__ compiler tag and limit yourself to access as a filehandle. The problem to solve is really quite simple. 1. Write the data files to the system at install time. 2. Know where you put them at run-time. Perl's install system creates an "auto" directory for both every distribution and for every module file. These are used by a couple of different auto-loading systems to store code fragments generated at install time, and various other modules written by the Perl "ancient masters". But the same mechanism is available to any dist or module to store any sort of data. =head2 Using Data in your Module C forms one half of a two part solution. Once the files have been installed to the correct directory, you can use C to find your files again after the installation. For the installation half of the solution, see L and its C directive. =head1 FUNCTIONS C provides four functions for locating files and directories. For greater maintainability, none of these are exported by default and you are expected to name the ones you want at use-time, or provide the C<':ALL'> tag. All of the following are equivalent. # Load but don't import, and then call directly use File::ShareDir; $dir = File::ShareDir::dist_dir('My-Dist'); # Import a single function use File::ShareDir 'dist_dir'; dist_dir('My-Dist'); # Import all the functions use File::ShareDir ':ALL'; dist_dir('My-Dist'); All of the functions will check for you that the dir/file actually exists, and that you have read permissions, or they will throw an exception. =cut use 5.005; use strict; use warnings; use Carp (); use Config (); use Exporter (); use File::Spec (); use Class::Inspector (); use vars qw{ $VERSION @ISA @EXPORT_OK %EXPORT_TAGS }; BEGIN { $VERSION = '1.104'; @ISA = qw{ Exporter }; @EXPORT_OK = qw{ dist_dir dist_file module_dir module_file class_dir class_file }; %EXPORT_TAGS = ( ALL => [ @EXPORT_OK ], ); } use constant IS_MACOS => !! ($^O eq 'MacOS'); ##################################################################### # Interface Functions =pod =head2 dist_dir # Get a distribution's shared files directory my $dir = dist_dir('My-Distribution'); The C function takes a single parameter of the name of an installed (CPAN or otherwise) distribution, and locates the shared data directory created at install time for it. Returns the directory path as a string, or dies if it cannot be located or is not readable. =cut sub dist_dir { my $dist = _DIST(shift); my $dir; # Try the new version $dir = _dist_dir_new( $dist ); return $dir if defined $dir; # Fall back to the legacy version $dir = _dist_dir_old( $dist ); return $dir if defined $dir; # Ran out of options Carp::croak("Failed to find share dir for dist '$dist'"); } sub _dist_dir_new { my $dist = shift; # Create the subpath my $path = File::Spec->catdir( 'auto', 'share', 'dist', $dist, ); # Find the full dir withing @INC foreach my $inc ( @INC ) { next unless defined $inc and ! ref $inc; my $dir = File::Spec->catdir( $inc, $path ); next unless -d $dir; unless ( -r $dir ) { Carp::croak("Found directory '$dir', but no read permissions"); } return $dir; } return undef; } sub _dist_dir_old { my $dist = shift; # Create the subpath my $path = File::Spec->catdir( 'auto', split( /-/, $dist ), ); # Find the full dir within @INC foreach my $inc ( @INC ) { next unless defined $inc and ! ref $inc; my $dir = File::Spec->catdir( $inc, $path ); next unless -d $dir; unless ( -r $dir ) { Carp::croak("Found directory '$dir', but no read permissions"); } return $dir; } return undef; } =pod =head2 module_dir # Get a module's shared files directory my $dir = module_dir('My::Module'); The C function takes a single parameter of the name of an installed (CPAN or otherwise) module, and locates the shared data directory created at install time for it. In order to find the directory, the module B be loaded when calling this function. Returns the directory path as a string, or dies if it cannot be located or is not readable. =cut sub module_dir { my $module = _MODULE(shift); my $dir; # Try the new version $dir = _module_dir_new( $module ); return $dir if defined $dir; # Fall back to the legacy version return _module_dir_old( $module ); } sub _module_dir_new { my $module = shift; # Create the subpath my $path = File::Spec->catdir( 'auto', 'share', 'module', _module_subdir( $module ), ); # Find the full dir withing @INC foreach my $inc ( @INC ) { next unless defined $inc and ! ref $inc; my $dir = File::Spec->catdir( $inc, $path ); next unless -d $dir; unless ( -r $dir ) { Carp::croak("Found directory '$dir', but no read permissions"); } return $dir; } return undef; } sub _module_dir_old { my $module = shift; my $short = Class::Inspector->filename($module); my $long = Class::Inspector->loaded_filename($module); $short =~ tr{/}{:} if IS_MACOS; substr( $short, -3, 3, '' ); $long =~ m/^(.*)\Q$short\E\.pm\z/s or die("Failed to find base dir"); my $dir = File::Spec->catdir( "$1", 'auto', $short ); unless ( -d $dir ) { Carp::croak("Directory '$dir', does not exist"); } unless ( -r $dir ) { Carp::croak("Directory '$dir', no read permissions"); } return $dir; } =pod =head2 dist_file # Find a file in our distribution shared dir my $dir = dist_file('My-Distribution', 'file/name.txt'); The C function takes two params of the distribution name and file name, locates the dist dir, and then finds the file within it, verifying that the file actually exists, and that it is readable. The filename should be a relative path in the format of your local filesystem. It will simply added to the directory using L's C method. Returns the file path as a string, or dies if the file or the dist's directory cannot be located, or the file is not readable. =cut sub dist_file { my $dist = _DIST(shift); my $file = _FILE(shift); # Try the new version first my $path = _dist_file_new( $dist, $file ); return $path if defined $path; # Hand off to the legacy version return _dist_file_old( $dist, $file );; } sub _dist_file_new { my $dist = shift; my $file = shift; # If it exists, what should the path be my $dir = _dist_dir_new( $dist ); my $path = File::Spec->catfile( $dir, $file ); # Does the file exist return undef unless -e $path; unless ( -f $path ) { Carp::croak("Found dist_file '$path', but not a file"); } unless ( -r $path ) { Carp::croak("File '$path', no read permissions"); } return $path; } sub _dist_file_old { my $dist = shift; my $file = shift; # Create the subpath my $path = File::Spec->catfile( 'auto', split( /-/, $dist ), $file, ); # Find the full dir withing @INC foreach my $inc ( @INC ) { next unless defined $inc and ! ref $inc; my $full = File::Spec->catdir( $inc, $path ); next unless -e $full; unless ( -r $full ) { Carp::croak("Directory '$full', no read permissions"); } return $full; } # Couldn't find it Carp::croak("Failed to find shared file '$file' for dist '$dist'"); } =pod =head2 module_file # Find a file in our module shared dir my $dir = module_file('My::Module', 'file/name.txt'); The C function takes two params of the module name and file name. It locates the module dir, and then finds the file within it, verifying that the file actually exists, and that it is readable. In order to find the directory, the module B be loaded when calling this function. The filename should be a relative path in the format of your local filesystem. It will simply added to the directory using L's C method. Returns the file path as a string, or dies if the file or the dist's directory cannot be located, or the file is not readable. =cut sub module_file { my $module = _MODULE(shift); my $file = _FILE(shift); my $dir = module_dir($module); my $path = File::Spec->catfile($dir, $file); unless ( -e $path ) { Carp::croak("File '$file' does not exist in module dir"); } unless ( -r $path ) { Carp::croak("File '$file' cannot be read, no read permissions"); } $path; } =pod =head2 class_file # Find a file in our module shared dir, or in our parent class my $dir = class_file('My::Module', 'file/name.txt'); The C function takes two params of the module name and file name. It locates the module dir, and then finds the file within it, verifying that the file actually exists, and that it is readable. In order to find the directory, the module B be loaded when calling this function. The filename should be a relative path in the format of your local filesystem. It will simply added to the directory using L's C method. If the file is NOT found for that module, C will scan up the module's @ISA tree, looking for the file in all of the parent classes. This allows you to, in effect, "subclass" shared files. Returns the file path as a string, or dies if the file or the dist's directory cannot be located, or the file is not readable. =cut sub class_file { my $module = _MODULE(shift); my $file = _FILE(shift); # Get the super path ( not including UNIVERSAL ) # Rather than using Class::ISA, we'll use an inlined version # that implements the same basic algorithm. my @path = (); my @queue = ( $module ); my %seen = ( $module => 1 ); while ( my $cl = shift @queue ) { push @path, $cl; no strict 'refs'; unshift @queue, grep { ! $seen{$_}++ } map { s/^::/main::/; s/\'/::/g; $_ } ( @{"${cl}::ISA"} ); } # Search up the path foreach my $class ( @path ) { local $@; my $dir = eval { module_dir($class); }; next if $@; my $path = File::Spec->catfile($dir, $file); unless ( -e $path ) { next; } unless ( -r $path ) { Carp::croak("File '$file' cannot be read, no read permissions"); } return $path; } Carp::croak("File '$file' does not exist in class or parent shared files"); } ##################################################################### # Support Functions sub _module_subdir { my $module = shift; $module =~ s/::/-/g; return $module; } sub _dist_packfile { my $module = shift; my @dirs = grep { -e } ( $Config::Config{archlibexp}, $Config::Config{sitearchexp} ); my $file = File::Spec->catfile( 'auto', split( /::/, $module), '.packlist', ); foreach my $dir ( @dirs ) { my $path = File::Spec->catfile( $dir, $file ); next unless -f $path; # Load the file my $packlist = ExtUtils::Packlist->new($path); unless ( $packlist ) { die "Failed to load .packlist file for $module"; } die "CODE INCOMPLETE"; } die "CODE INCOMPLETE"; } # Inlined from Params::Util pure perl version sub _CLASS { (defined $_[0] and ! ref $_[0] and $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s) ? $_[0] : undef; } # Maintainer note: The following private functions are used by # File::ShareDir::PAR. (It has to or else it would have to copy&fork) # So if you significantly change or even remove them, please # notify the File::ShareDir::PAR maintainer(s). Thank you! # Matches a valid distribution name ### This is a total guess at this point sub _DIST { if ( defined $_[0] and ! ref $_[0] and $_[0] =~ /^[a-z0-9+_-]+$/is ) { return shift; } Carp::croak("Not a valid distribution name"); } # A valid and loaded module name sub _MODULE { my $module = _CLASS(shift) or Carp::croak("Not a valid module name"); if ( Class::Inspector->loaded($module) ) { return $module; } Carp::croak("Module '$module' is not loaded"); } # A valid file name sub _FILE { my $file = shift; unless ( defined $file and ! ref $file and length $file ) { Carp::croak("Did not pass a file name"); } if ( File::Spec->file_name_is_absolute($file) ) { Carp::croak("Cannot use absolute file name '$file'"); } $file; } 1; =pod =head1 SUPPORT Bugs should always be submitted via the CPAN bug tracker L For other issues, contact the maintainer. =head1 AUTHOR Adam Kennedy Eadamk@cpan.orgE =head1 SEE ALSO L, L, L, L, L, L =head1 COPYRIGHT Copyright 2005 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. =cut File-ShareDir-1.104/inc/inc_File-ShareDir-Install/000755 000765 000024 00000000000 13125201535 021420 5ustar00snostaff000000 000000 File-ShareDir-1.104/inc/latest/000755 000765 000024 00000000000 13125201535 016101 5ustar00snostaff000000 000000 File-ShareDir-1.104/inc/latest.pm000644 000765 000024 00000000236 13071452224 016443 0ustar00snostaff000000 000000 # This stub created by inc::latest 0.500 package inc::latest; use strict; use vars '@ISA'; require inc::latest::private; @ISA = qw/inc::latest::private/; 1; File-ShareDir-1.104/inc/latest/private.pm000644 000765 000024 00000006016 13071452224 020117 0ustar00snostaff000000 000000 use strict; use warnings; package inc::latest::private; # ABSTRACT: private implementation for inc::latest our $VERSION = '0.500'; use File::Spec; use IO::File; # must ultimately "goto" the import routine of the module to be loaded # so that the calling package is correct when $mod->import() runs. sub import { my ( $package, $mod, @args ) = @_; my $file = $package->_mod2path($mod); if ( $INC{$file} ) { # Already loaded, but let _load_module handle import args goto \&_load_module; } # A bundled copy must be present my ( $bundled, $bundled_dir ) = $package->_search_bundled($file) or die "No bundled copy of $mod found"; my $from_inc = $package->_search_INC($file); unless ($from_inc) { # Only bundled is available unshift( @INC, $bundled_dir ); goto \&_load_module; } if ( _version($from_inc) >= _version($bundled) ) { # Ignore the bundled copy goto \&_load_module; } # Load the bundled copy unshift( @INC, $bundled_dir ); goto \&_load_module; } sub _version { require ExtUtils::MakeMaker; return ExtUtils::MM->parse_version(shift); } # use "goto" for import to preserve caller sub _load_module { my $package = shift; # remaining @_ is ready for goto my ( $mod, @args ) = @_; eval "require $mod; 1" or die $@; if ( my $import = $mod->can('import') ) { goto $import; } return 1; } sub _search_bundled { my ( $self, $file ) = @_; my $mypath = 'inc'; local *DH; # Maintain 5.005 compatibility opendir DH, $mypath or die "Can't open directory $mypath: $!"; while ( defined( my $e = readdir DH ) ) { next unless $e =~ /^inc_/; my $try = File::Spec->catfile( $mypath, $e, $file ); return ( $try, File::Spec->catdir( $mypath, $e ) ) if -e $try; } return; } # Look for the given path in @INC. sub _search_INC { # TODO: doesn't handle coderefs or arrayrefs or objects in @INC, but # it probably should my ( $self, $file ) = @_; foreach my $dir (@INC) { next if ref $dir; my $try = File::Spec->catfile( $dir, $file ); return $try if -e $try; } return; } # Translate a module name into a directory/file.pm to search for in @INC sub _mod2path { my ( $self, $mod ) = @_; my @parts = split /::/, $mod; $parts[-1] .= '.pm'; return $parts[0] if @parts == 1; return File::Spec->catfile(@parts); } 1; # vim: ts=4 sts=4 sw=4 tw=75 et: __END__ =pod =encoding UTF-8 =head1 NAME inc::latest::private - private implementation for inc::latest =head1 VERSION version 0.500 =head1 DESCRIPTION This module has the private methods used to find and load bundled modules. It should not be used directly. =head1 AUTHORS =over 4 =item * David Golden =item * Eric Wilhelm =back =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2009 by David Golden. This is free software, licensed under: The Apache License, Version 2.0, January 2004 =cut File-ShareDir-1.104/inc/inc_File-ShareDir-Install/File/000755 000765 000024 00000000000 13125201535 022277 5ustar00snostaff000000 000000 File-ShareDir-1.104/inc/inc_File-ShareDir-Install/File/ShareDir/000755 000765 000024 00000000000 13125201535 024000 5ustar00snostaff000000 000000 File-ShareDir-1.104/inc/inc_File-ShareDir-Install/File/ShareDir/Install.pm000644 000765 000024 00000025350 13071452224 025754 0ustar00snostaff000000 000000 package File::ShareDir::Install; # git description: v0.10-8-gf7e9d47 # ABSTRACT: Install shared files use 5.008; use strict; use warnings; use Carp; use File::Spec; use IO::Dir; our $VERSION = '0.11'; our @DIRS; our %ALREADY; require Exporter; our @ISA = qw( Exporter ); our @EXPORT = qw( install_share delete_share ); our @EXPORT_OK = qw( postamble install_share delete_share ); our $INCLUDE_DOTFILES = 0; our $INCLUDE_DOTDIRS = 0; ##################################################################### sub install_share { my $dir = @_ ? pop : 'share'; my $type = @_ ? shift : 'dist'; unless ( defined $type and ( $type =~ /^(module|dist)$/ ) ) { confess "Illegal or invalid share dir type '$type'"; } if( $type eq 'dist' and @_ ) { confess "Too many parameters to install_share"; } my $def = _mk_def( $type ); _add_module( $def, $_[0] ); _add_dir( $def, $dir ); } ##################################################################### sub delete_share { my $dir = @_ ? pop : ''; my $type = @_ ? shift : 'dist'; unless ( defined $type and ( $type =~ /^(module|dist)$/ ) ) { confess "Illegal or invalid share dir type '$type'"; } if( $type eq 'dist' and @_ ) { confess "Too many parameters to delete_share"; } my $def = _mk_def( "delete-$type" ); _add_module( $def, $_[0] ); _add_dir( $def, $dir ); } # # Build a task definition sub _mk_def { my( $type ) = @_; return { type=>$type, dotfiles => $INCLUDE_DOTFILES, dotdirs => $INCLUDE_DOTDIRS }; } # # Add the module to a task definition sub _add_module { my( $def, $class ) = @_; if( $def->{type} =~ /module$/ ) { my $module = _CLASS( $class ); unless ( defined $module ) { confess "Missing or invalid module name '$_[0]'"; } $def->{module} = $module; } } # # Add directories to a task definition # Save the definition sub _add_dir { my( $def, $dir ) = @_; $dir = [ $dir ] unless ref $dir; my $del = 0; $del = 1 if $def->{type} =~ /^delete-/; foreach my $d ( @$dir ) { unless ( $del or (defined $d and -d $d) ) { confess "Illegal or missing directory '$d'"; } if( not $del and $ALREADY{ $d }++ ) { confess "Directory '$d' is already being installed"; } push @DIRS, { %$def }; $DIRS[-1]{dir} = $d; } } ##################################################################### # Build the postamble section sub postamble { my $self = shift; my @ret; # = $self->SUPER::postamble( @_ ); foreach my $def ( @DIRS ) { push @ret, __postamble_share_dir( $self, $def ); } return join "\n", @ret; } ##################################################################### sub __postamble_share_dir { my( $self, $def ) = @_; my $dir = $def->{dir}; my( $idir ); if( $def->{type} eq 'delete-dist' ) { $idir = File::Spec->catdir( _dist_dir(), $dir ); } elsif( $def->{type} eq 'delete-module' ) { $idir = File::Spec->catdir( _module_dir( $def ), $dir ); } elsif ( $def->{type} eq 'dist' ) { $idir = _dist_dir(); } else { # delete-share and share $idir = _module_dir( $def ); } my @cmds; if( $def->{type} =~ /^delete-/ ) { @cmds = "\$(RM_RF) $idir"; } else { my $autodir = '$(INST_LIB)'; my $pm_to_blib = $self->oneliner(<split_command( $pm_to_blib, %$files ); } my $r = join '', map { "\t\$(NOECHO) $_\n" } @cmds; # use Data::Dumper; # die Dumper $files; # Set up the install return "config::\n$r"; } # Get the per-dist install directory. # We depend on the Makefile for most of the info sub _dist_dir { return File::Spec->catdir( '$(INST_LIB)', qw( auto share dist ), '$(DISTNAME)' ); } # Get the per-module install directory # We depend on the Makefile for most of the info sub _module_dir { my( $def ) = @_; my $module = $def->{module}; $module =~ s/::/-/g; return File::Spec->catdir( '$(INST_LIB)', qw( auto share module ), $module ); } sub _scan_share_dir { my( $files, $idir, $dir, $def ) = @_; my $dh = IO::Dir->new( $dir ) or die "Unable to read $dir: $!"; my $entry; while( defined( $entry = $dh->read ) ) { next if $entry =~ /(~|,v|#)$/; my $full = File::Spec->catfile( $dir, $entry ); if( -f $full ) { next if not $def->{dotfiles} and $entry =~ /^\./; $files->{ $full } = File::Spec->catfile( $idir, $entry ); } elsif( -d $full ) { if( $def->{dotdirs} ) { next if $entry eq '.' or $entry eq '..' or $entry =~ /^\.(svn|git|cvs)$/; } else { next if $entry =~ /^\./; } _scan_share_dir( $files, File::Spec->catdir( $idir, $entry ), $full, $def ); } } } ##################################################################### # Cloned from Params::Util::_CLASS sub _CLASS ($) { ( defined $_[0] and ! ref $_[0] and $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*$/s ) ? $_[0] : undef; } 1; __END__ =pod =encoding UTF-8 =head1 NAME File::ShareDir::Install - Install shared files =head1 VERSION version 0.11 =head1 SYNOPSIS use ExtUtils::MakeMaker; use File::ShareDir::Install; install_share 'share'; install_share dist => 'dist-share'; install_share module => 'My::Module' => 'other-share'; WriteMakefile( ... ); # As you normally would package MY; use File::ShareDir::Install qw(postamble); =head1 DESCRIPTION File::ShareDir::Install allows you to install read-only data files from a distribution. It is a companion module to L, which allows you to locate these files after installation. It is a port of L to L with the improvement of only installing the files you want; C<.svn>, C<.git> and other source-control junk will be ignored. Please note that this module installs read-only data files; empty directories will be ignored. =head1 EXPORT =head2 install_share install_share $dir; install_share dist => $dir; install_share module => $module, $dir; Causes all the files in C<$dir> and its sub-directories to be installed into a per-dist or per-module share directory. Must be called before L. The first 2 forms are equivalent; the files are installed in a per-distribution directory. For example C. The name of that directory can be recovered with L. The last form installs files in a per-module directory. For example C. The name of that directory can be recovered with L. The parameter C<$dir> may be an array of directories. The files will be installed when you run C. However, the list of files to install is generated when Makefile.PL is run. Note that if you make multiple calls to C on different directories that contain the same filenames, the last of these calls takes precedence. In other words, if you do: install_share 'share1'; install_share 'share2'; And both C and C contain a file called C, the file C will be installed into your C. =head2 delete_share delete_share $list; delete_share dist => $list; delete_share module => $module, $list; Remove previously installed files or directories. Unlike L, the last parameter is a list of files or directories that were previously installed. These files and directories will be deleted when you run C. The parameter C<$list> may be an array of files or directories. Deletion happens in-order along with installation. This means that you may delete all previously installed files by putting the following at the top of your Makefile.PL. delete_share '.'; You can also selectively remove some files from installation. install_share 'some-dir'; if( ... ) { delete_share 'not-this-file.rc'; } =head2 postamble This function must be exported into the MY package. You will normally do this with the following. package MY; use File::ShareDir::Install qw( postamble ); If you need to overload postamble, use the following. package MY; use File::ShareDir::Install; sub postamble { my $self = shift; my @ret = File::ShareDir::Install::postamble( $self ); # ... add more things to @ret; return join "\n", @ret; } =head1 CONFIGURATION Two variables control the handling of dot-files and dot-directories. A dot-file has a filename that starts with a period (.). For example C<.htaccess>. A dot-directory is a directory that starts with a period (.). For example C<.config/>. Not all filesystems support the use of dot-files. =head2 $INCLUDE_DOTFILES If set to a true value, dot-files will be copied. Default is false. =head2 $INCLUDE_DOTDIRS If set to a true value, the files inside dot-directories will be copied. Known version control directories are still ignored. Default is false. =head2 Note These variables only influence subsequent calls to C. This allows you to control the behaviour for each directory. For example: $INCLUDE_DOTDIRS = 1; install_share 'share1'; $INCLUDE_DOTFILES = 1; $INCLUDE_DOTDIRS = 0; install_share 'share2'; The directory C will have files in its dot-directories installed, but not dot-files. The directory C will have files in its dot-files installed, but dot-directories will be ignored. =head1 SEE ALSO L, L. =head1 SUPPORT Bugs may be submitted through L (or L). =head1 AUTHOR Philip Gwyn =head1 CONTRIBUTOR =for stopwords Karen Etheridge Karen Etheridge =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2009 by Philip Gwyn. 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 File-ShareDir-1.104/foo/test_file.txt000644 000765 000024 00000000022 12333442550 017334 0ustar00snostaff000000 000000 Another test file