Hello community,

here is the log from the commit of package perl-File-ShareDir for 
openSUSE:Factory checked in at 2018-07-04 23:48:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-File-ShareDir (Old)
 and      /work/SRC/openSUSE:Factory/.perl-File-ShareDir.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-File-ShareDir"

Wed Jul  4 23:48:18 2018 rev:13 rq:617826 version:1.112

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-File-ShareDir/perl-File-ShareDir.changes    
2018-06-18 13:50:22.517045500 +0200
+++ 
/work/SRC/openSUSE:Factory/.perl-File-ShareDir.new/perl-File-ShareDir.changes   
    2018-07-04 23:48:22.760339755 +0200
@@ -1,0 +2,20 @@
+Tue Jun 19 05:22:48 UTC 2018 - [email protected]
+
+- updated to 1.112
+   see /usr/share/doc/packages/perl-File-ShareDir/Changes
+
+  1.112        2018-06-18
+      - Fix tests that fail when running as root (RT#125602,
+        thanks Wesley Schwengle <[email protected]>)
+      - Fix tests fail on MSWin32 for similar reason as the
+        root failures from RT#125602
+      - clarify support rules
+      - improve POD
+  
+  1.110        2018-06-16
+      - remove unused/incomplete _dist_packfile
+      - increase test coverage
+      - refactor _search_inc_path
+      - add badges to POD
+
+-------------------------------------------------------------------

Old:
----
  File-ShareDir-1.108.tar.gz

New:
----
  File-ShareDir-1.112.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-File-ShareDir.spec ++++++
--- /var/tmp/diff_new_pack.uPQWxo/_old  2018-07-04 23:48:23.256339207 +0200
+++ /var/tmp/diff_new_pack.uPQWxo/_new  2018-07-04 23:48:23.256339207 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           perl-File-ShareDir
-Version:        1.108
+Version:        1.112
 Release:        0
 %define cpan_name File-ShareDir
 Summary:        Locate per-dist and per-module shared files
@@ -33,6 +33,7 @@
 BuildRequires:  perl(Class::Inspector) >= 1.12
 BuildRequires:  perl(Test::More) >= 0.9
 Requires:       perl(Class::Inspector) >= 1.12
+Recommends:     perl(List::MoreUtils) >= 0.428
 Recommends:     perl(Params::Util) >= 1.07
 %{perl_requires}
 

++++++ File-ShareDir-1.108.tar.gz -> File-ShareDir-1.112.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-ShareDir-1.108/Changes 
new/File-ShareDir-1.112/Changes
--- old/File-ShareDir-1.108/Changes     2018-06-15 15:29:55.000000000 +0200
+++ new/File-ShareDir-1.112/Changes     2018-06-18 22:34:28.000000000 +0200
@@ -1,5 +1,19 @@
 Revision history for Perl extension File-ShareDir
 
+1.112  2018-06-18
+    - Fix tests that fail when running as root (RT#125602,
+      thanks Wesley Schwengle <[email protected]>)
+    - Fix tests fail on MSWin32 for similar reason as the
+      root failures from RT#125602
+    - clarify support rules
+    - improve POD
+
+1.110  2018-06-16
+    - remove unused/incomplete _dist_packfile
+    - increase test coverage
+    - refactor _search_inc_path
+    - add badges to POD
+
 1.108  2018-06-15
     - Fix RT#125582: Undefined subroutine &File::ShareDir::croak
       called reported by yseto and Andreas Koenig (via RT#125575)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-ShareDir-1.108/MANIFEST 
new/File-ShareDir-1.112/MANIFEST
--- old/File-ShareDir-1.108/MANIFEST    2018-06-15 15:31:14.000000000 +0200
+++ new/File-ShareDir-1.112/MANIFEST    2018-06-18 22:36:42.000000000 +0200
@@ -16,6 +16,7 @@
 t/03_extensions.t
 t/04_fail.t
 t/05_class.t
+t/06_old.t
 t/lib/ShareDir/TestClass.pm
 META.yml                                 Module YAML meta-data (added by 
MakeMaker)
 META.json                                Module JSON meta-data (added by 
MakeMaker)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-ShareDir-1.108/META.json 
new/File-ShareDir-1.112/META.json
--- old/File-ShareDir-1.108/META.json   2018-06-15 15:31:14.000000000 +0200
+++ new/File-ShareDir-1.112/META.json   2018-06-18 22:36:41.000000000 +0200
@@ -54,6 +54,7 @@
       },
       "runtime" : {
          "recommends" : {
+            "List::MoreUtils" : "0.428",
             "Params::Util" : "1.07"
          },
          "requires" : {
@@ -81,6 +82,6 @@
          "web" : "https://github.com/perl5-utils/File-ShareDir";
       }
    },
-   "version" : "1.108",
+   "version" : "1.112",
    "x_serialization_backend" : "JSON::PP version 2.97001"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-ShareDir-1.108/META.yml 
new/File-ShareDir-1.112/META.yml
--- old/File-ShareDir-1.108/META.yml    2018-06-15 15:31:14.000000000 +0200
+++ new/File-ShareDir-1.112/META.yml    2018-06-18 22:36:41.000000000 +0200
@@ -21,6 +21,7 @@
     - t
     - inc
 recommends:
+  List::MoreUtils: '0.428'
   Params::Util: '1.07'
 requires:
   Carp: '0'
@@ -31,5 +32,5 @@
   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.108'
+version: '1.112'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-ShareDir-1.108/Makefile.PL 
new/File-ShareDir-1.112/Makefile.PL
--- old/File-ShareDir-1.108/Makefile.PL 2018-06-10 14:15:21.000000000 +0200
+++ new/File-ShareDir-1.112/Makefile.PL 2018-06-15 18:50:46.000000000 +0200
@@ -86,7 +86,10 @@
             test    => {requires => {%TEST_DEPS}},
             runtime => {
                 requires   => {%RUN_DEPS},
-                recommends => {'Params::Util' => '1.07'},
+                recommends => {
+                    'Params::Util'    => '1.07',
+                    'List::MoreUtils' => '0.428'
+                },
             },
         },
     },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-ShareDir-1.108/README.md 
new/File-ShareDir-1.112/README.md
--- old/File-ShareDir-1.108/README.md   2018-06-15 15:25:52.000000000 +0200
+++ new/File-ShareDir-1.112/README.md   2018-06-18 22:02:56.000000000 +0200
@@ -2,6 +2,12 @@
 
 File::ShareDir - Locate per-dist and per-module shared files
 
+<div>
+    <a href="https://travis-ci.org/perl5-utils/File-ShareDir";><img 
src="https://travis-ci.org/perl5-utils/File-ShareDir.svg?branch=master"; 
alt="Travis CI"/></a>
+    <a 
href='https://coveralls.io/github/perl5-utils/File-ShareDir?branch=master'><img 
src='https://coveralls.io/repos/github/perl5-utils/File-ShareDir/badge.svg?branch=master'
 alt='Coverage Status' /></a>
+    <a href="https://saythanks.io/to/rehsack";><img 
src="https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg"; alt="Say Thanks" 
/></a>
+</div>
+
 # SYNOPSIS
 
     use File::ShareDir ':ALL';
@@ -235,19 +241,67 @@
 
 # SUPPORT
 
-Bugs should always be submitted via the CPAN bug tracker
+Bugs should always be submitted via the CPAN request tracker, see below.
+
+You can find documentation for this module with the perldoc command.
+
+    perldoc File::ShareDir
+
+You can also look for information at:
+
+- RT: CPAN's request tracker
+
+    
[http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-ShareDir](http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-ShareDir)
+
+- AnnoCPAN: Annotated CPAN documentation
+
+    
[http://annocpan.org/dist/File-ShareDir](http://annocpan.org/dist/File-ShareDir)
+
+- CPAN Ratings
+
+    
[http://cpanratings.perl.org/s/File-ShareDir](http://cpanratings.perl.org/s/File-ShareDir)
 
-[http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-ShareDir](http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-ShareDir)
+- CPAN Search
 
-For other issues, contact the maintainer.
+    
[http://search.cpan.org/dist/File-ShareDir/](http://search.cpan.org/dist/File-ShareDir/)
+
+## Where can I go for other help?
+
+If you have a bug report, a patch or a suggestion, please open a new
+report ticket at CPAN (but please check previous reports first in case
+your issue has already been addressed).
+
+Report tickets should contain a detailed description of the bug or
+enhancement request and at least an easily verifiable way of
+reproducing the issue or fix. Patches are always welcome, too.
+
+## Where can I go for help with a concrete version?
+
+Bugs and feature requests are accepted against the latest version
+only. To get patches for earlier versions, you need to get an
+agreement with a developer of your choice - who may or not report the
+issue and a suggested fix upstream (depends on the license you have
+chosen).
+
+## Business support and maintenance
+
+For business support you can contact the maintainer via his CPAN
+email address. Please keep in mind that business support is neither
+available for free nor are you eligible to receive any support
+based on the license distributed with this package.
 
 # AUTHOR
 
 Adam Kennedy <[email protected]>
 
+## MAINTAINER
+
+Jens Rehsack <[email protected]>
+
 # SEE ALSO
 
-[File::ShareDir::Install](https://metacpan.org/pod/File::ShareDir::Install), 
[File::HomeDir](https://metacpan.org/pod/File::HomeDir),
+[File::ShareDir::Install](https://metacpan.org/pod/File::ShareDir::Install),
+[File::ConfigDir](https://metacpan.org/pod/File::ConfigDir), 
[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)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-ShareDir-1.108/lib/File/ShareDir.pm 
new/File-ShareDir-1.112/lib/File/ShareDir.pm
--- old/File-ShareDir-1.108/lib/File/ShareDir.pm        2018-06-15 
15:25:38.000000000 +0200
+++ new/File-ShareDir-1.112/lib/File/ShareDir.pm        2018-06-18 
22:34:55.000000000 +0200
@@ -6,6 +6,14 @@
 
 File::ShareDir - Locate per-dist and per-module shared files
 
+=begin html
+
+<a href="https://travis-ci.org/perl5-utils/File-ShareDir";><img 
src="https://travis-ci.org/perl5-utils/File-ShareDir.svg?branch=master"; 
alt="Travis CI"/></a>
+<a 
href='https://coveralls.io/github/perl5-utils/File-ShareDir?branch=master'><img 
src='https://coveralls.io/repos/github/perl5-utils/File-ShareDir/badge.svg?branch=master'
 alt='Coverage Status' /></a>
+<a href="https://saythanks.io/to/rehsack";><img 
src="https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg"; alt="Say Thanks" 
/></a>
+
+=end html
+
 =head1 SYNOPSIS
 
   use File::ShareDir ':ALL';
@@ -137,7 +145,7 @@
 our %EXPORT_TAGS = (
     ALL => [@EXPORT_OK],
 );
-our $VERSION = '1.108';
+our $VERSION = '1.112';
 
 #####################################################################
 # Interface Functions
@@ -163,12 +171,9 @@
     my $dist = _DIST(shift);
     my $dir;
 
-    # Try the new version
-    $dir = _dist_dir_new($dist);
-    return $dir if defined $dir;
+    # Try the new version, then fall back to the legacy version
+    $dir = _dist_dir_new($dist) || _dist_dir_old($dist);
 
-    # Fall back to the legacy version
-    $dir = _dist_dir_old($dist);
     return $dir if defined $dir;
 
     # Ran out of options
@@ -182,7 +187,7 @@
     return $DIST_SHARE{$dist} if exists $DIST_SHARE{$dist};
 
     # Create the subpath
-    my $path = File::Spec->catdir('auto', 'share', 'dist', $dist,);
+    my $path = File::Spec->catdir('auto', 'share', 'dist', $dist);
 
     # Find the full dir withing @INC
     return _search_inc_path($path);
@@ -224,14 +229,8 @@
 
     return $MODULE_SHARE{$module} if exists $MODULE_SHARE{$module};
 
-    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);
+    # Try the new version first, then fall back to the legacy version
+    return _module_dir_new($module) || _module_dir_old($module);
 }
 
 sub _module_dir_new
@@ -257,14 +256,9 @@
     $long =~ m/^(.*)\Q$short\E\.pm\z/s or Carp::croak("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");
-    }
+    -d $dir or Carp::croak("Directory '$dir': No such directory");
+    -r $dir or Carp::croak("Directory '$dir': No read permission");
+
     return $dir;
 }
 
@@ -293,12 +287,14 @@
     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;
+    # Try the new version first, in doubt hand off to the legacy version
+    my $path = _dist_file_new($dist, $file) || _dist_file_old($dist, $file);
+    $path or Carp::croak("Failed to find shared file '$file' for dist 
'$dist'");
+
+    -f $path or Carp::croak("File '$path': No such file");
+    -r $path or Carp::croak("File '$path': No read permission");
 
-    # Hand off to the legacy version
-    return _dist_file_old($dist, $file);
+    return $path;
 }
 
 sub _dist_file_new
@@ -313,14 +309,6 @@
 
     # 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;
 }
@@ -330,12 +318,15 @@
     my $dist = shift;
     my $file = shift;
 
-    # Create the subpath
-    my $path = File::Spec->catfile('auto', split(/-/, $dist), $file,);
+    # If it exists, what should the path be
+    my $dir = _dist_dir_old($dist);
+    return undef unless defined $dir;
+    my $path = File::Spec->catfile($dir, $file);
 
-    # Find the full dir withing @INC
-    return _search_inc_path($path)
-      || Carp::croak("Failed to find shared file '$file' for dist '$dist'");
+    # Does the file exist
+    return undef unless -e $path;
+
+    return $path;
 }
 
 =pod
@@ -367,14 +358,10 @@
     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");
-    }
+
+    -e $path or Carp::croak("File '$path' does not exist in module dir");
+    -r $path or Carp::croak("File '$path': No read permission");
+
     return $path;
 }
 
@@ -439,28 +426,48 @@
     Carp::croak("File '$file' does not exist in class or parent shared files");
 }
 
+## no critic (BuiltinFunctions::ProhibitStringyEval)
+if (eval "use List::MoreUtils 0.428; 1;")
+{
+    List::MoreUtils->import("firstres");
+}
+else
+{
+    ## no critic (ErrorHandling::RequireCheckingReturnValueOfEval)
+    eval <<'END_OF_BORROWED_CODE';
+sub firstres (&@)
+{
+    my $test = shift;
+    foreach (@_)
+    {
+        my $testval = $test->();
+        $testval and return $testval;
+    }
+    return undef;
+}
+END_OF_BORROWED_CODE
+}
+
 #####################################################################
 # Support Functions
 
 sub _search_inc_path
 {
-
     my $path = shift;
 
     # Find the full dir within @INC
-    foreach my $inc (@INC)
-    {
-        defined $inc or next;
-        ref $inc and next;
+    my $dir = firstres(
+        sub {
+            my $d;
+            $d = File::Spec->catdir($_, $path) if defined _STRING($_);
+            defined $d and -d $d and return $d;
+        },
+        @INC
+    ) or return;
 
-        my $dir = File::Spec->catdir($inc, $path);
-        next unless -d $dir;
+    Carp::croak("Found directory '$dir', but no read permissions") unless -r 
$dir;
 
-        -r $dir or Carp::croak("Found directory '$dir', but no read 
permissions");
-        return $dir;
-    }
-
-    return undef;
+    return $dir;
 }
 
 sub _module_subdir
@@ -470,31 +477,8 @@
     return $module;
 }
 
-sub _dist_packfile    ## no critic 
(Subroutines::ProhibitUnusedPrivateSubroutines)
-{
-    my $module = shift;
-    use Config ();
-    ## no critic (Variables::ProhibitPackageVars)
-    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);
-        $packlist or Carp::croak("Failed to load .packlist file for $module");
-
-        Carp::croak("CODE INCOMPLETE");
-    }
-
-    Carp::croak("CODE INCOMPLETE");
-}
-
 ## no critic (BuiltinFunctions::ProhibitStringyEval)
-if (eval "use Params::Util; 1;")
+if (eval "use Params::Util 1.07; 1;")
 {
     Params::Util->import("_CLASS", "_STRING");
 }
@@ -594,19 +578,71 @@
 
 =head1 SUPPORT
 
-Bugs should always be submitted via the CPAN bug tracker
+Bugs should always be submitted via the CPAN request tracker, see below.
+
+You can find documentation for this module with the perldoc command.
+
+    perldoc File::ShareDir
+
+You can also look for information at:
+
+=over 4
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-ShareDir>
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/File-ShareDir>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/s/File-ShareDir>
 
-L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-ShareDir>
+=item * CPAN Search
 
-For other issues, contact the maintainer.
+L<http://search.cpan.org/dist/File-ShareDir/>
+
+=back
+
+=head2 Where can I go for other help?
+
+If you have a bug report, a patch or a suggestion, please open a new
+report ticket at CPAN (but please check previous reports first in case
+your issue has already been addressed).
+
+Report tickets should contain a detailed description of the bug or
+enhancement request and at least an easily verifiable way of
+reproducing the issue or fix. Patches are always welcome, too.
+
+=head2 Where can I go for help with a concrete version?
+
+Bugs and feature requests are accepted against the latest version
+only. To get patches for earlier versions, you need to get an
+agreement with a developer of your choice - who may or not report the
+issue and a suggested fix upstream (depends on the license you have
+chosen).
+
+=head2 Business support and maintenance
+
+For business support you can contact the maintainer via his CPAN
+email address. Please keep in mind that business support is neither
+available for free nor are you eligible to receive any support
+based on the license distributed with this package.
 
 =head1 AUTHOR
 
 Adam Kennedy E<lt>[email protected]<gt>
 
+=head2 MAINTAINER
+
+Jens Rehsack E<lt>[email protected]<gt>
+
 =head1 SEE ALSO
 
-L<File::ShareDir::Install>, L<File::HomeDir>,
+L<File::ShareDir::Install>,
+L<File::ConfigDir>, L<File::HomeDir>,
 L<Module::Install>, L<Module::Install::Share>,
 L<File::ShareDir::PAR>, L<Dist::Zilla::Plugin::ShareDir>
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-ShareDir-1.108/t/01_compile.t 
new/File-ShareDir-1.112/t/01_compile.t
--- old/File-ShareDir-1.108/t/01_compile.t      2018-06-09 18:50:48.000000000 
+0200
+++ new/File-ShareDir-1.112/t/01_compile.t      2018-06-18 21:47:43.000000000 
+0200
@@ -10,8 +10,12 @@
     $^W = 1;
 }
 
-use Test::More tests => 2;
+use Test::More;
 
 ok($] > 5.005, 'Perl version is 5.005 or newer');
 
 use_ok('File::ShareDir');
+
+diag("Testing File::ShareDir $File::ShareDir::VERSION, Perl $], $^X, UID: $<");
+
+done_testing();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-ShareDir-1.108/t/04_fail.t 
new/File-ShareDir-1.112/t/04_fail.t
--- old/File-ShareDir-1.108/t/04_fail.t 2018-06-15 10:42:28.000000000 +0200
+++ new/File-ShareDir-1.112/t/04_fail.t 2018-06-18 21:38:30.000000000 +0200
@@ -3,8 +3,15 @@
 use strict;
 use warnings;
 
+use Cwd            ('abs_path');
+use File::Basename ('dirname');
+use File::Path     ('make_path', 'remove_tree');
+use File::Spec     ();
+use POSIX;
 use Test::More;
 
+use constant NO_PERMISSION_CHECK => ($^O eq 'MSWin32' or $< == 0);
+
 sub dies
 {
     my $code    = shift;
@@ -17,6 +24,25 @@
 
 use File::ShareDir ':ALL';
 
+my $testlib = File::Spec->catdir(abs_path(dirname($0)), "lib");
+unshift @INC, $testlib;
+
+use_ok("ShareDir::TestClass");
+
+my $testautolib     = File::Spec->catdir($testlib,     "auto");
+my $testsharedirold = File::Spec->catdir($testautolib, qw(ShareDir TestClass));
+
+dies(sub { File::ShareDir::_DIST("ShareDir::TestClass") }, qr/Not a valid 
distribution name/, "Not a valid distribution name");
+dies(
+    sub {
+        File::ShareDir::_FILE(File::Spec->catfile($testsharedirold, 
"file.txt"));
+    },
+    qr/Cannot use absolute file name/,
+    "Cannot use absolute file name"
+);
+
+END { remove_tree($testautolib); }
+
 dies(sub { module_dir() },   qr/Not a valid module name/, 'No params to 
module_dir dies');
 dies(sub { module_dir('') }, qr/Not a valid module name/, 'Null param to 
module_dir dies');
 dies(
@@ -31,4 +57,113 @@
     "Getting non-existant file dies"
 );
 
+remove_tree($testautolib);
+
+dies(sub { my $dist_dir = dist_dir('ShareDir-TestClass'); }, qr/Failed to find 
share dir for dist/, "No module directory");
+dies(sub { my $module_dir = module_dir('ShareDir::TestClass'); }, qr/No such 
directory/, "Old module directory but file");
+
+make_path(dirname($testsharedirold), {mode => 0700});
+make_path($testsharedirold,          {mode => 0100});
+
+SKIP:
+{
+    skip("Root always has read permissions", 1) if NO_PERMISSION_CHECK;
+    dies(
+        sub { my $module_dir = module_dir('ShareDir::TestClass'); },
+        qr/No read permission/,
+        "New module directory without read permission"
+    );
+}
+
+my $testsharedirnew = File::Spec->catdir($testautolib, qw(share dist 
ShareDir-TestClass));
+make_path(dirname($testsharedirnew), {mode => 0700});
+make_path($testsharedirnew,          {mode => 0100});
+
+SKIP:
+{
+    skip("Root always has read permissions", 1) if NO_PERMISSION_CHECK;
+    dies(
+        sub { my $dist_dir = dist_dir('ShareDir-TestClass'); },
+        qr/but no read permissions/,
+        "New module directory without read permission"
+    );
+}
+
+remove_tree($testautolib);
+open(my $fh, ">", $testsharedirold);
+close($fh);
+
+dies(sub { my $module_dir = module_dir('ShareDir::TestClass'); }, qr/No such 
directory/, "Old module directory but file");
+dies(sub { my $dist_dir = dist_dir('ShareDir-TestClass'); }, qr/Failed to find 
share dir for dist/,
+    "Old dist directory but file");
+dies(
+    sub { my $dist_file = dist_file('ShareDir-TestClass', 'noread.txt'); },
+    qr/Failed to find shared file/,
+    "Old dist directory but file"
+);
+
+remove_tree($testautolib);
+make_path($testsharedirold, {mode => 0700});
+
+sysopen($fh, File::Spec->catfile($testsharedirold, qw(noread.txt)), O_RDWR | 
O_CREAT, 0200) or diag("$!");
+print $fh "Moep\n";
+close($fh);
+
+SKIP:
+{
+    skip("Root always has read permissions", 3) if NO_PERMISSION_CHECK;
+    dies(sub { my $dist_file = dist_file('ShareDir-TestClass', 'noread.txt'); 
}, qr/No read permission/, "Unreadable dist_file");
+    dies(
+        sub { my $module_file = module_file('ShareDir::TestClass', 
'noread.txt'); },
+        qr/No read permission/,
+        "Unreadable module_file"
+    );
+    dies(
+        sub { my $class_file = class_file('ShareDir::TestClass', 
'noread.txt'); },
+        qr/cannot be read, no read permissions/,
+        "Unreadable class_file"
+    );
+}
+
+dies(
+    sub { my $module_file = module_file('ShareDir::TestClass', 'noehere.txt'); 
},
+    qr/does not exist in module dir/,
+    "Unavailable module_file"
+);
+
+dies(
+    sub { my $class_file = class_file('ShareDir::TestClass', 'noehere.txt'); },
+    qr/does not exist in class or parent shared files/,
+    "Unavailable class_file"
+);
+
+make_path(File::Spec->catdir($testsharedirold, "weird.dir"), {mode => 0700});
+dies(sub { my $dist_file = dist_file('ShareDir-TestClass', 'weird.dir'); }, 
qr/No such file/, "Dir instead of file");
+
+eval <<EOM;
+package Module::WithOut::File;
+
+sub new { return bless {}, __PACKAGE__ }
+
+1;
+EOM
+$INC{'Module/WithOut/File.pm'} = '1';
+
+dies(sub { my $module_dir = module_dir('Module::WithOut::File'); }, qr/Failed 
to find base dir/, "No really a loaded module ...");
+
+SCOPE:
+{
+    my @TEST_INC = @INC;
+    local @INC = (undef, Module::WithOut::File->new(), @TEST_INC);
+    my $dist_dir = dist_dir('ShareDir-TestClass');
+    ok($dist_dir, "Found dist_dir even with weird \@INC");
+}
+
+dies(
+    sub { File::ShareDir::_DIST(Module::WithOut::File->new()) },
+    qr/Not a valid distribution name/,
+    "Object instead of distribution"
+);
+dies(sub { File::ShareDir::_FILE(Module::WithOut::File->new()) }, qr/Did not 
pass a file name/, "Did not pass a file name");
+
 done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/File-ShareDir-1.108/t/06_old.t 
new/File-ShareDir-1.112/t/06_old.t
--- old/File-ShareDir-1.108/t/06_old.t  1970-01-01 01:00:00.000000000 +0100
+++ new/File-ShareDir-1.112/t/06_old.t  2018-06-15 18:20:19.000000000 +0200
@@ -0,0 +1,46 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Cwd            ('abs_path');
+use File::Basename ('dirname');
+use File::Path     ('make_path', 'remove_tree');
+use File::Spec     ();
+use Test::More;
+
+my $testlib = File::Spec->catdir(abs_path(dirname($0)), "lib");
+unshift @INC, $testlib;
+
+my $testautolib     = File::Spec->catdir($testlib,     "auto");
+my $testsharedirold = File::Spec->catdir($testautolib, qw(ShareDir TestClass));
+
+END { remove_tree($testautolib); }
+
+use_ok('File::ShareDir', 'module_dir', 'module_file', 'dist_dir', 'dist_file', 
'class_file');
+use_ok("ShareDir::TestClass");
+
+is(File::ShareDir::_MODULE('ShareDir::TestClass'), 'ShareDir::TestClass', 
'_MODULE returns correct for known loaded module',);
+is(File::ShareDir::_DIST('ShareDir-TestClass'),    'ShareDir-TestClass',  
'_DIST returns correct for known good dist',);
+
+remove_tree($testautolib);
+make_path($testsharedirold, {mode => 0700});
+open(my $fh, ">", File::Spec->catfile($testsharedirold, qw(sample.txt)));
+close($fh);
+
+my $module_dir = module_dir('ShareDir::TestClass');
+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');
+
+my $dist_dir = dist_dir('ShareDir-TestClass');
+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('ShareDir-TestClass', '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');
+
+done_testing;


Reply via email to