Hello community, here is the log from the commit of package perl-Module-Path for openSUSE:Factory checked in at 2015-04-15 16:21:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Module-Path (Old) and /work/SRC/openSUSE:Factory/.perl-Module-Path.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Module-Path" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Module-Path/perl-Module-Path.changes 2013-08-01 15:58:42.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Module-Path.new/perl-Module-Path.changes 2015-04-15 16:21:57.000000000 +0200 @@ -1,0 +2,6 @@ +Mon Apr 13 17:41:57 UTC 2015 - [email protected] + +- updated to 0.19 + see /usr/share/doc/packages/perl-Module-Path/Changes + +------------------------------------------------------------------- Old: ---- Module-Path-0.09.tar.gz New: ---- Module-Path-0.19.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Module-Path.spec ++++++ --- /var/tmp/diff_new_pack.07FbSI/_old 2015-04-15 16:21:57.000000000 +0200 +++ /var/tmp/diff_new_pack.07FbSI/_new 2015-04-15 16:21:57.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Module-Path # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: perl-Module-Path -Version: 0.09 +Version: 0.19 Release: 0 %define cpan_name Module-Path Summary: get the full path to a locally installed module @@ -31,12 +31,13 @@ BuildRequires: perl-macros BuildRequires: perl(Devel::FindPerl) BuildRequires: perl(Test::More) >= 0.88 -#BuildRequires: perl(Module::Path) %{perl_requires} %description -Module::Path provides a single function, 'module_path()', which will find -where a module is installed locally. +This module provides a single function, 'module_path()', which takes a +module name and finds the first directory in your '@INC' path where the +module is installed locally. It returns the full path to that file, +resolving any symlinks. It is portable and only depends on core modules. It works by looking in all the directories in '@INC' for an appropriately named file: @@ -75,6 +76,6 @@ %files -f %{name}.files %defattr(-,root,root,755) -%doc Changes LICENSE README +%doc Changes LICENSE README TODO.md %changelog ++++++ Module-Path-0.09.tar.gz -> Module-Path-0.19.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/Changes new/Module-Path-0.19/Changes --- old/Module-Path-0.09/Changes 2013-01-20 22:32:48.000000000 +0100 +++ new/Module-Path-0.19/Changes 2015-03-16 22:23:42.000000000 +0100 @@ -1,4 +1,76 @@ -Revision history for perl module Module::Path +Revision history for Perl module Module::Path + +0.19 2015-03-16 NEILB + - Added [MetaJSON] to dist.ini, so META.json will go into the distribution, + as well as META.yml. Thanks to Lucas Kanashiro. + - Dropped the -r test on directories, as we only actually need -d and -x. + Thanks to Lucas Kanashiro. + +0.18 2014-12-17 + - RIBASUSHI++ reminded me that to be a usable directory in @INC we need + to check -d && -r && -x. + +0.17 2014-12-17 + - Fixed RT#96433: ignore directories in @INC which don't exist. + Apologies to ETHER++ for over-thinking this one, + and taking so long to fix it. + +0.16 2014-12-13 + - Added TODO.md with an initial todo list for the module + +0.15 2014-10-14 + - Doing a foreach $dir (@INC) and then resolving symblinks on $dir + was changing the entries in @INC. HAARG++ for pull request with fix. + - Changed author email address to be my CPAN email address. + +0.14 2014-08-16 + - Added Travis config, using cpanfile and cpanm to ensure all dependencies + are installed before running tests with prove. + Thanks to DAGOLDEN. + - Improved the first paragraph of DESCRIPTION, so search results give + a better summary of the module. + +0.13 2014-02-22 + - Looks like in some rare circumstances, Cwd::abs_path() can croak, + so now we wrap that in eval { } and deal accordingly. + +0.12 2014-02-19 + - We now fully resolve symlinks in @INC paths. The previous 'fix' + for Debian broke the tests on FreeBSD. + Thanks to Géraud Continsouzas, and Daniel Lintott for help testing. + +0.11_03 2014-02-18 + - Another place where we need to worry about getting undef. + +0.11_02 2014-02-18 + - Wasn't handling the case where abs_path() returns undef, + which it does if a symlink "goes nowhere". + +0.11_01 2014-02-18 + - The testsuite fix in 0.11 caused a breakage on FreeBSD, + where a directory path contains a symlink that wasn't + the final directory. So now module_path() fully resolves + all symlinks in the path, using Cwd::abs_path(). + +0.11 2014-02-17 + - Testsuite now uses Cwd::abs_path() on paths from %INC, + to cope with synlinks in @INC directories. + This was causing test failures on Debian(-based) systems. + Thanks to Daniel Lintott and Erez Schatz for reporting + and testing proposed fix. + +0.10_01 2014-02-16 + - Developer release with the change that made it into + 0.11, above. + +0.10 2014-02-04 + - mpath can display paths for multiple modules (Ahmad Syaltut) + - specified min perl version 5.6.0 + +0.09_01 2013-08-21 + - If a directory in @INC is a symlink, return the linked-to directory + in the path. Problem report and patch from Sharl Morlaroll + https://github.com/neilbowers/Module-Path/issues/4 0.09 2013-01-20 - You can now pass partial module paths, in the format diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/LICENSE new/Module-Path-0.19/LICENSE --- old/Module-Path-0.09/LICENSE 2013-01-20 22:32:48.000000000 +0100 +++ new/Module-Path-0.19/LICENSE 2015-03-16 22:23:42.000000000 +0100 @@ -1,4 +1,4 @@ -This software is copyright (c) 2012 by Neil Bowers. +This software is copyright (c) 2013 by Neil Bowers. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. @@ -12,7 +12,7 @@ --- The GNU General Public License, Version 1, February 1989 --- -This software is Copyright (c) 2012 by Neil Bowers. +This software is Copyright (c) 2013 by Neil Bowers. This is free software, licensed under: @@ -22,7 +22,7 @@ Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. - 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA + 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. @@ -272,7 +272,7 @@ --- The Artistic License 1.0 --- -This software is Copyright (c) 2012 by Neil Bowers. +This software is Copyright (c) 2013 by Neil Bowers. This is free software, licensed under: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/MANIFEST new/Module-Path-0.19/MANIFEST --- old/Module-Path-0.09/MANIFEST 2013-01-20 22:32:48.000000000 +0100 +++ new/Module-Path-0.19/MANIFEST 2015-03-16 22:23:42.000000000 +0100 @@ -1,10 +1,14 @@ +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.032. Changes LICENSE MANIFEST +META.json META.yml Makefile.PL README +TODO.md bin/mpath +cpanfile dist.ini lib/Module/Path.pm t/01-require.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/META.json new/Module-Path-0.19/META.json --- old/Module-Path-0.09/META.json 1970-01-01 01:00:00.000000000 +0100 +++ new/Module-Path-0.19/META.json 2015-03-16 22:23:42.000000000 +0100 @@ -0,0 +1,54 @@ +{ + "abstract" : "get the full path to a locally installed module", + "author" : [ + "Neil Bowers <[email protected]>" + ], + "dynamic_config" : 0, + "generated_by" : "Dist::Zilla version 5.032, CPAN::Meta::Converter version 2.143240", + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : "2" + }, + "name" : "Module-Path", + "prereqs" : { + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + } + }, + "runtime" : { + "requires" : { + "Cwd" : "0", + "Exporter" : "0", + "File::Basename" : "0", + "Getopt::Long" : "0", + "Pod::Usage" : "0", + "perl" : "5.006", + "strict" : "0", + "warnings" : "0" + } + }, + "test" : { + "requires" : { + "Devel::FindPerl" : "0", + "File::Spec::Functions" : "0", + "FindBin" : "0.05", + "Test::More" : "0.88" + } + } + }, + "release_status" : "stable", + "resources" : { + "homepage" : "https://github.com/neilbowers/Module-Path", + "repository" : { + "type" : "git", + "url" : "https://github.com/neilbowers/Module-Path.git", + "web" : "https://github.com/neilbowers/Module-Path" + } + }, + "version" : "0.19" +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/META.yml new/Module-Path-0.19/META.yml --- old/Module-Path-0.09/META.yml 2013-01-20 22:32:48.000000000 +0100 +++ new/Module-Path-0.19/META.yml 2015-03-16 22:23:42.000000000 +0100 @@ -1,26 +1,31 @@ --- abstract: 'get the full path to a locally installed module' author: - - 'Neil Bowers <[email protected]>' + - 'Neil Bowers <[email protected]>' build_requires: - Devel::FindPerl: 0 - File::Spec::Functions: 0 - FindBin: 0.05 - Test::More: 0.88 + Devel::FindPerl: '0' + File::Spec::Functions: '0' + FindBin: '0.05' + Test::More: '0.88' configure_requires: - ExtUtils::MakeMaker: 6.30 + ExtUtils::MakeMaker: '0' dynamic_config: 0 -generated_by: 'Dist::Zilla version 4.300029, CPAN::Meta::Converter version 2.120921' +generated_by: 'Dist::Zilla version 5.032, CPAN::Meta::Converter version 2.143240' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + version: '1.4' name: Module-Path requires: - Exporter: 0 - strict: 0 - warnings: 0 + Cwd: '0' + Exporter: '0' + File::Basename: '0' + Getopt::Long: '0' + Pod::Usage: '0' + perl: '5.006' + strict: '0' + warnings: '0' resources: - bugtracker: https://github.com/neilbowers/Module-Path/issues - repository: git://github.com/neilbowers/Module-Path.git -version: 0.09 + homepage: https://github.com/neilbowers/Module-Path + repository: https://github.com/neilbowers/Module-Path.git +version: '0.19' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/Makefile.PL new/Module-Path-0.19/Makefile.PL --- old/Module-Path-0.09/Makefile.PL 2013-01-20 22:32:48.000000000 +0100 +++ new/Module-Path-0.19/Makefile.PL 2015-03-16 22:23:42.000000000 +0100 @@ -1,60 +1,69 @@ - +# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.032. use strict; use warnings; +use 5.006; - -use ExtUtils::MakeMaker 6.30; - - +use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "get the full path to a locally installed module", - "AUTHOR" => "Neil Bowers <neil\@bowers.com>", - "BUILD_REQUIRES" => { - "Devel::FindPerl" => 0, - "File::Spec::Functions" => 0, - "FindBin" => "0.05", - "Test::More" => "0.88" - }, + "AUTHOR" => "Neil Bowers <neilb\@cpan.org>", "CONFIGURE_REQUIRES" => { - "ExtUtils::MakeMaker" => "6.30" + "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Module-Path", "EXE_FILES" => [ "bin/mpath" ], "LICENSE" => "perl", + "MIN_PERL_VERSION" => "5.006", "NAME" => "Module::Path", "PREREQ_PM" => { + "Cwd" => 0, "Exporter" => 0, + "File::Basename" => 0, + "Getopt::Long" => 0, + "Pod::Usage" => 0, "strict" => 0, "warnings" => 0 }, - "VERSION" => "0.09", + "TEST_REQUIRES" => { + "Devel::FindPerl" => 0, + "File::Spec::Functions" => 0, + "FindBin" => "0.05", + "Test::More" => "0.88" + }, + "VERSION" => "0.19", "test" => { "TESTS" => "t/*.t" } ); -unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) { - my $br = delete $WriteMakefileArgs{BUILD_REQUIRES}; - my $pp = $WriteMakefileArgs{PREREQ_PM}; - for my $mod ( keys %$br ) { - if ( exists $pp->{$mod} ) { - $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod}; - } - else { - $pp->{$mod} = $br->{$mod}; - } - } +my %FallbackPrereqs = ( + "Cwd" => 0, + "Devel::FindPerl" => 0, + "Exporter" => 0, + "ExtUtils::MakeMaker" => 0, + "File::Basename" => 0, + "File::Spec::Functions" => 0, + "FindBin" => "0.05", + "Getopt::Long" => 0, + "Pod::Usage" => 0, + "Test::More" => "0.88", + "strict" => 0, + "warnings" => 0 +); + + +unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { + delete $WriteMakefileArgs{TEST_REQUIRES}; + delete $WriteMakefileArgs{BUILD_REQUIRES}; + $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); - - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/README new/Module-Path-0.19/README --- old/Module-Path-0.09/README 2013-01-20 22:32:48.000000000 +0100 +++ new/Module-Path-0.19/README 2015-03-16 22:23:42.000000000 +0100 @@ -1,13 +1,15 @@ This archive contains the distribution Module-Path, -version 0.09: +version 0.19: get the full path to a locally installed module -This software is copyright (c) 2012 by Neil Bowers. +This software is copyright (c) 2013 by Neil Bowers. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. +This README file was generated by Dist::Zilla::Plugin::Readme v5.032. + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/TODO.md new/Module-Path-0.19/TODO.md --- old/Module-Path-0.09/TODO.md 1970-01-01 01:00:00.000000000 +0100 +++ new/Module-Path-0.19/TODO.md 2015-03-16 22:23:42.000000000 +0100 @@ -0,0 +1,3 @@ +* Add tests for different permutations of -x, -d, -r on directories in @INC +* Add tests for all the different permutations with symlinks +* Full test coverage with Devel::Cover diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/bin/mpath new/Module-Path-0.19/bin/mpath --- old/Module-Path-0.09/bin/mpath 2013-01-20 22:32:48.000000000 +0100 +++ new/Module-Path-0.19/bin/mpath 2015-03-16 22:23:42.000000000 +0100 @@ -1,39 +1,99 @@ #!/usr/bin/env perl use strict; use warnings; +use 5.006; use Module::Path qw(module_path); +use Getopt::Long qw(GetOptions); +use Pod::Usage qw(pod2usage); -die "Usage: $0 <module>\n" unless @ARGV == 1; -my $module = shift @ARGV; -my $path = module_path($module); -if (!defined($path)) { - die "$module not found\n"; +GetOptions(\my %opts, 'help|h|?', 'quiet|q', 'full|f') + or pod2usage 2; + +if ($opts{help}) { + pod2usage( + -verbose => 2, + -exitval => 0, + ) +} +elsif (!@ARGV) { + pod2usage( + -message => 'No module specified', + -verbose => 1, + ); +} + +my $all_found = 1; + +for my $module (@ARGV) { + my $path = module_path($module); + if (!defined($path)) { + $all_found = 0; + print "$module not found\n" unless $opts{quiet}; + } + else { + print "$module " if $opts{full}; + print "$path\n"; + } } -print $path, "\n"; -exit 0; + +my $status = $all_found ? 0 : 1; +exit $status; =head1 NAME mpath - display the full path to a perl module (installed locally) -=head1 SYNOPSIS +=head1 USAGE + + mpath [OPTIONS] MODULE [MODULE ...] + +=head1 EXAMPLE % mpath Module::Path /usr/local/lib/perl5/site_perl/5.16.0/Module/Path.pm + % mpath --full Module::Path + Module::Path /usr/local/lib/perl5/site_perl/5.16.0/Module/Path.pm + + % mpath Moose Moo + /usr/local/lib/perl5/site_perl/5.16.0/darwin-2level/Moose.pm + /usr/local/lib/perl5/site_perl/5.16.0/Moo.pm + =head1 DESCRIPTION mpath displays the full path to a perl module on the local system. It uses the C<module_path()> function from L<Module::Path> to get the path. -At the moment the script only lets you list one argument; anything else -and it will die with a usage message. - -If the module wasn't found, C<mpath> will die with the following message: +If one of the module wasn't found, mpath will exit with the exit code 1 and +print the following message (you can silence it with the option B<--quiet>): % mpath Foo::Bar Foo::Bar not found +or: + + % mpath Moose Foo::Bar + /usr/local/lib/perl5/site_perl/5.16.0/darwin-2level/Moose.pm + Foo::Bar not found + +=head1 OPTIONS + +=over + +=item B<-h>, B<-?>, B<--help> + +Print this help message and exit. + +=item B<-f>, B<--full> + +Print module name. + +=item B<-q>, B<--quiet> + +Don't print any error when one of the module requested could not be found. + +=back + =head1 SEE ALSO L<Module::Path> @@ -48,4 +108,3 @@ This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/cpanfile new/Module-Path-0.19/cpanfile --- old/Module-Path-0.09/cpanfile 1970-01-01 01:00:00.000000000 +0100 +++ new/Module-Path-0.19/cpanfile 2015-03-16 22:23:42.000000000 +0100 @@ -0,0 +1,19 @@ +requires "Cwd" => "0"; +requires "Exporter" => "0"; +requires "File::Basename" => "0"; +requires "Getopt::Long" => "0"; +requires "Pod::Usage" => "0"; +requires "perl" => "5.006"; +requires "strict" => "0"; +requires "warnings" => "0"; + +on 'test' => sub { + requires "Devel::FindPerl" => "0"; + requires "File::Spec::Functions" => "0"; + requires "FindBin" => "0.05"; + requires "Test::More" => "0.88"; +}; + +on 'configure' => sub { + requires "ExtUtils::MakeMaker" => "0"; +}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/dist.ini new/Module-Path-0.19/dist.ini --- old/Module-Path-0.09/dist.ini 2013-01-20 22:32:48.000000000 +0100 +++ new/Module-Path-0.19/dist.ini 2015-03-16 22:23:42.000000000 +0100 @@ -1,14 +1,26 @@ name = Module-Path -author = Neil Bowers <[email protected]> +author = Neil Bowers <[email protected]> license = Perl_5 copyright_holder = Neil Bowers -copyright_year = 2012 +copyright_year = 2013 -version = 0.09 +version = 0.19 -[@Basic] +[@Filter] +-bundle = @Basic +-remove = GatherDir +[GatherDir] +exclude_filename = cpanfile +[CPANFile] +[CopyFilesFromBuild] +copy = cpanfile [PkgVersion] [AutoPrereqs] +[ExtraTests] -[GitHub::Meta] -repo = Module-Path +[GithubMeta] +[MetaJSON] + +[Git::Tag] +tag_message= +[Git::Push] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/lib/Module/Path.pm new/Module-Path-0.19/lib/Module/Path.pm --- old/Module-Path-0.09/lib/Module/Path.pm 2013-01-20 22:32:48.000000000 +0100 +++ new/Module-Path-0.19/lib/Module/Path.pm 2015-03-16 22:23:42.000000000 +0100 @@ -1,10 +1,11 @@ -use strict; -use warnings; package Module::Path; -{ - $Module::Path::VERSION = '0.09'; -} # ABSTRACT: get the full path to a locally installed module +$Module::Path::VERSION = '0.19'; +use 5.006; +use strict; +use warnings; +use File::Basename 'dirname'; +use Cwd qw/ abs_path /; require Exporter; @@ -32,12 +33,26 @@ ($relpath = $module) =~ s/::/$SEPARATOR/g; $relpath .= '.pm' unless $relpath =~ m!\.pm$!; + DIRECTORY: foreach my $dir (@INC) { + next DIRECTORY if not defined($dir); + # see 'perldoc -f require' on why you might find # a reference in @INC - next if ref($dir); + next DIRECTORY if ref($dir); + + next unless -d $dir && -x $dir; + + # The directory path might have a symlink somewhere in it, + # so we get an absolute path (ie resolve any symlinks). + # The previous attempt at this only dealt with the case + # where the final directory in the path was a symlink, + # now we're trying to deal with symlinks anywhere in the path. + my $abs_dir = $dir; + eval { $abs_dir = abs_path($abs_dir); }; + next DIRECTORY if $@ || !defined($abs_dir); - $fullpath = $dir.$SEPARATOR.$relpath; + $fullpath = $abs_dir.$SEPARATOR.$relpath; return $fullpath if -f $fullpath; } @@ -63,8 +78,11 @@ =head1 DESCRIPTION -Module::Path provides a single function, C<module_path()>, -which will find where a module is installed locally. +This module provides a single function, C<module_path()>, +which takes a module name and finds the first directory in your C<@INC> path +where the module is installed locally. +It returns the full path to that file, resolving any symlinks. +It is portable and only depends on core modules. It works by looking in all the directories in C<@INC> for an appropriately named file: @@ -90,6 +108,11 @@ =item +If a directory in C<@INC> is a symlink, then we resolve the path, +and return a path containing the linked-to directory. + +=item + If no file was found, return C<undef>. =back diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/t/02-module-path.t new/Module-Path-0.19/t/02-module-path.t --- old/Module-Path-0.09/t/02-module-path.t 2013-01-20 22:32:48.000000000 +0100 +++ new/Module-Path-0.19/t/02-module-path.t 2015-03-16 22:23:42.000000000 +0100 @@ -6,23 +6,32 @@ use Test::More 0.88 tests => 3; use Module::Path 'module_path'; +use Cwd qw/ abs_path /; + +my $expected_path; # This test does "use strict", so %INC should include the path where # strict.pm was found, and module_path should find the same -ok(module_path('strict') eq $INC{'strict.pm'}, +eval { $expected_path = abs_path($INC{'strict.pm'}); }; +ok(!$@ && module_path('strict') eq $expected_path, "check 'strict' matches \%INC") || do { warn "\n", - " \%INC : $INC{'strict.pm'}\n", - " module_path : ", (module_path('strict') || 'undef'), "\n", - " \$^O : $^O\n"; + " \%INC : $INC{'strict.pm'}\n", + " expected path : $expected_path\n", + " module_path : ", (module_path('strict') || 'undef'), "\n", + ($@ ? " \$\@ : $@\n" : ''), + " \$^O : $^O\n"; }; -ok(module_path('Test/More.pm') eq $INC{'Test/More.pm'}, +eval { $expected_path = abs_path($INC{'Test/More.pm'}); }; +ok(!$@ && module_path('Test/More.pm') eq $expected_path, "confirm that module_path() works with partial path used as key in \%INC") || do { warn "\n", - " \%INC : $INC{'Test/More.pm'}\n", - " module_path : ", (module_path('Test/More.pm') || 'undef'), "\n", - " \$^O : $^O\n"; + " \%INC : $INC{'Test/More.pm'}\n", + " expected path : $expected_path\n", + " module_path : ", (module_path('Test/More.pm') || 'undef'), "\n", + ($@ ? " \$\@ : $@\n" : ''), + " \$^O : $^O\n"; }; # module_path() returns undef if module not found in @INC diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Path-0.09/t/03-mpath.t new/Module-Path-0.19/t/03-mpath.t --- old/Module-Path-0.09/t/03-mpath.t 2013-01-20 22:32:48.000000000 +0100 +++ new/Module-Path-0.19/t/03-mpath.t 2015-03-16 22:23:42.000000000 +0100 @@ -3,14 +3,16 @@ use strict; use warnings; -use Test::More 0.88 tests => 2; +use Test::More 0.88; use FindBin 0.05; use File::Spec::Functions; use Devel::FindPerl qw(find_perl_interpreter); +use Cwd qw/ abs_path /; my $PERL = find_perl_interpreter() || die "can't find perl!\n"; my $MPATH = catfile( $FindBin::Bin, updir(), qw(bin mpath) ); my $path; +my $expected_path; # # The mpath script's hashbang line is: @@ -27,15 +29,55 @@ # This test does "use strict", so %INC should include the path where # strict.pm was found, and module_path should find the same -ok($? == 0 && defined($path) && $path eq $INC{'strict.pm'}, +$expected_path = abs_path($INC{'strict.pm'}); +ok($? == 0 && defined($path) && $path eq $expected_path, "check 'mpath strict' matches \%INC") || do { warn "\n", - " \%INC : $INC{'strict.pm'}\n", - " module_path : $path\n", - " \$^O : $^O\n"; + " \%INC : $INC{'strict.pm'}\n", + " expected_path : $expected_path\n", + " module_path : $path\n", + " \$^O : $^O\n"; }; # module_path() returns undef if module not found in @INC chomp($path = `"$PERL" "$MPATH" No::Such::Module 2>&1`); ok($? != 0 && defined($path) && $path eq 'No::Such::Module not found', "non-existent module should result in failure"); + +chomp($path = `"$PERL" "$MPATH" strict warnings 2>&1`); + +ok($? == 0, 'exit status is 0'); +ok(defined($path), 'path for both strict.pm and warnings.pm are defined'); +is($path, abs_path($INC{'strict.pm'}).$/.abs_path($INC{'warnings.pm'}), 'and they match %INC'); + +chomp($path = `"$PERL" "$MPATH" strict warnings No::Such::Module 2>&1`); + +ok($? != 0, 'exit status is not zero'); +ok(defined($path), 'path is defined'); +is( + $path, + abs_path($INC{'strict.pm'}).$/.abs_path($INC{'warnings.pm'})."$/No::Such::Module not found", + 'got expected output' +); + +chomp($path = `"$PERL" "$MPATH" --quiet strict warnings No::Such::Module 2>&1`); + +ok($? != 0, 'exit status is not zero'); +ok(defined($path), 'path is defined'); +is( + $path, + abs_path($INC{'strict.pm'}).$/.abs_path($INC{'warnings.pm'}), + "error message should not be printed when the option --quiet is specified" +); + +chomp($path = `"$PERL" "$MPATH" --full strict warnings 2>&1`); + +ok($? == 0, 'exit status is zero'); +ok(defined($path), 'path is defined'); +is( + $path, + "strict ".abs_path($INC{'strict.pm'})."$/warnings ".abs_path($INC{'warnings.pm'}), + "module name should be printed right before its path if the option --full is specified" +); + +done_testing;
