In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/e50af245705329617325f329ad3250122ecbf59a?hp=0c2829400b005cbfc6543affe3aa5a63616b7498>

- Log -----------------------------------------------------------------
commit e50af245705329617325f329ad3250122ecbf59a
Author: Craig A. Berry <[email protected]>
Date:   Sun Feb 26 09:21:31 2012 -0600

    Bump Pod::Html version.

M       ext/Pod-Html/lib/Pod/Html.pm

commit bd9756aaa2be339ac85461c5c0da6909ebfac799
Author: Craig A. Berry <[email protected]>
Date:   Sun Feb 26 09:18:04 2012 -0600

    Portability tweaks to Pod::Html's cache.t.
    
    We need to unixify the current working directory since we're going
    to be comparing to the pod root that has been unixified internally
    in Pod::Html.
    
    Also clean up all versions of the generated files.

M       ext/Pod-Html/t/cache.t

commit 1e33ffe43f81ff0cc6660854eb7a901d30fa31c6
Author: Craig A. Berry <[email protected]>
Date:   Sun Feb 26 09:10:27 2012 -0600

    Better cross-platform unixify for Pod::Html.
    
    This is mostly borrowed from CPANPLUS with additional tweaks to
    handle corner cases presented by the Pod::Html tests.  It seems
    to work on VMS, Windows, and Mac OS X.
    
    Also tweak _save_page to make the call to ab2rel more robust in
    the case wherethe base is a special string indicating the current
    working directory ('./', '[]', or '.\') rather than a literal path.

M       ext/Pod-Html/lib/Pod/Html.pm

commit 12fddd398f7ab89902312f4663cdc9990618bd45
Author: Craig A. Berry <[email protected]>
Date:   Sun Feb 26 09:07:42 2012 -0600

    Different differences for Pod::Html tests.
    
    Windows has FC (file compare), VMS has DIFFERENCES, and Linux is
    certainly not the only OS that can do unified diff.

M       ext/Pod-Html/t/pod2html-lib.pl
-----------------------------------------------------------------------

Summary of changes:
 ext/Pod-Html/lib/Pod/Html.pm   |   30 ++++++++++++++++++++++++++----
 ext/Pod-Html/t/cache.t         |    7 ++++---
 ext/Pod-Html/t/pod2html-lib.pl |   22 ++++++++++++----------
 3 files changed, 42 insertions(+), 17 deletions(-)

diff --git a/ext/Pod-Html/lib/Pod/Html.pm b/ext/Pod-Html/lib/Pod/Html.pm
index 694c5b0..8fc74a4 100644
--- a/ext/Pod-Html/lib/Pod/Html.pm
+++ b/ext/Pod-Html/lib/Pod/Html.pm
@@ -3,7 +3,7 @@ use strict;
 require Exporter;
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
-$VERSION = 1.15;
+$VERSION = 1.15_01;
 @ISA = qw(Exporter);
 @EXPORT = qw(pod2html htmlify);
 @EXPORT_OK = qw(anchorify);
@@ -645,7 +645,10 @@ sub _save_page {
     my ($modspec, $modname) = @_;
 
     # Remove Podroot from path
-    $modspec = File::Spec->abs2rel($modspec, $Podroot);
+    $modspec = $Podroot eq File::Spec->curdir
+               ? File::Spec->abs2rel($modspec)
+               : File::Spec->abs2rel($modspec,
+                                     File::Spec->canonpath($Podroot));
 
     # Convert path to unix style path
     $modspec = Pod::Html::_unixify($modspec);
@@ -657,9 +660,28 @@ sub _save_page {
 sub _unixify {
     my $full_path = shift;
     return '' unless $full_path;
+    return $full_path if $full_path eq '/';
 
-    return File::Spec::Unix->catfile( # change \s to /s and such
-               File::Spec->splitdir($full_path));
+    my ($vol, $dirs, $file) = File::Spec->splitpath($full_path);
+    my @dirs = $dirs eq File::Spec->curdir()
+               ? (File::Spec::Unix->curdir())
+               : File::Spec->splitdir($dirs);
+    if (defined($vol) && $vol) {
+        $vol =~ s/:$// if $^O eq 'VMS';
+
+        if( $dirs[0] ) {
+            unshift @dirs, $vol;
+        }
+        else {
+            $dirs[0] = $vol;
+        }
+    }
+    unshift @dirs, '' if File::Spec->file_name_is_absolute($full_path);
+    return $file unless scalar(@dirs);
+    $full_path = File::Spec::Unix->catfile(File::Spec::Unix->catdir(@dirs),
+                                           $file);
+    $full_path =~ s|^\/|| if $^O eq 'MSWin32'; # C:/foo works, /C:/foo doesn't
+    return $full_path;
 }
 
 package Pod::Simple::XHTML::LocalPodLinks;
diff --git a/ext/Pod-Html/t/cache.t b/ext/Pod-Html/t/cache.t
index 5a8e1fe..3a48a3c 100644
--- a/ext/Pod-Html/t/cache.t
+++ b/ext/Pod-Html/t/cache.t
@@ -13,7 +13,7 @@ use Pod::Html;
 use Data::Dumper;
 use Test::More tests => 10;
 
-my $cwd = Cwd::cwd();
+my $cwd = Pod::Html::_unixify(Cwd::cwd());
 my $infile = "t/cache.pod";
 my $outfile = "cacheout.html";
 my $cachefile = "pod2htmd.tmp";
@@ -65,7 +65,8 @@ chdir($cwd);
 is_deeply(\%pages, \%expected_pages, "cache contents");
 close $cache;
 
-unlink $outfile;
-unlink $cachefile, $tcachefile;
+1 while unlink $outfile;
+1 while unlink $cachefile;
+1 while unlink $tcachefile;
 is(-f $cachefile, undef, "No cache file to end");
 is(-f $tcachefile, undef, "No cache file to end");
diff --git a/ext/Pod-Html/t/pod2html-lib.pl b/ext/Pod-Html/t/pod2html-lib.pl
index c03f38a..0327e2b 100644
--- a/ext/Pod-Html/t/pod2html-lib.pl
+++ b/ext/Pod-Html/t/pod2html-lib.pl
@@ -69,23 +69,25 @@ sub convert_n_test {
 
     my $diff = '/bin/diff';
     -x $diff or $diff = '/usr/bin/diff';
-    if (-x $diff) {
+    -x $diff or $diff = undef;
+    my $diffopt = $diff ? $^O =~ m/(linux|darwin)/ ? '-u' : '-c'
+                        : '';
+    $diff = 'fc/n' if $^O =~ /^MSWin/;
+    $diff = 'differences' if $^O eq 'VMS';
+    if ($diff) {
        ok($expect eq $result, $testname) or do {
-         my $expectfile = "pod2html-lib.tmp";
+         my $expectfile = "${podfile}_expected.tmp";
          open my $tmpfile, ">", $expectfile or die $!;
          print $tmpfile $expect;
          close $tmpfile;
-         my $diffopt = $^O eq 'linux' ? 'u' : 'c';
-         open my $diff, "diff -$diffopt $expectfile $outfile |" or die $!;
-         print STDERR "# $_" while <$diff>;
-         close $diff;
+         open my $diff_fh, "$diff $diffopt $expectfile $outfile |" or die $!;
+         print STDERR "# $_" while <$diff_fh>;
+         close $diff_fh;
          unlink $expectfile;
        };
     } else {
-       # This is fairly evil, but lets us get detailed failure modes on
-       # Win32, where we have the most trouble working and the least chance of
-       # having diff in /bin or /usr/bin! (Invoking diff in our tests is
-       # pretty evil, too, so...) -- rjbs, 2012-02-22
+       # This is fairly evil, but lets us get detailed failure modes
+       # anywhere that we've failed to identify a diff program.
        is($expect, $result, $testname);
     }
 

--
Perl5 Master Repository

Reply via email to