summaryrefslogtreecommitdiff
path: root/ext/Pod-Html
diff options
context:
space:
mode:
authorMarc Green <marcgreen@cpan.org>2011-06-24 11:13:23 -0400
committerMarc Green <marcgreen@cpan.org>2011-10-31 13:26:41 -0400
commit18f1a6e3a6a2fe0c14e1602b6cc055b838df9af4 (patch)
tree723d496e109ec7754e2645d850ad473d95e88b25 /ext/Pod-Html
parent632db2755bddba77b12e0eff0b7a8cd5554291b1 (diff)
downloadperl-18f1a6e3a6a2fe0c14e1602b6cc055b838df9af4.tar.gz
Fix bug with removal of Podroot from each Podpath
Correct the lack of possible offset when removing Podroot from each Podpath to account for a trailing slash in Podroot.
Diffstat (limited to 'ext/Pod-Html')
-rw-r--r--ext/Pod-Html/lib/Pod/Html.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/Pod-Html/lib/Pod/Html.pm b/ext/Pod-Html/lib/Pod/Html.pm
index 3dbe6e44f6..552466b3d9 100644
--- a/ext/Pod-Html/lib/Pod/Html.pm
+++ b/ext/Pod-Html/lib/Pod/Html.pm
@@ -496,7 +496,8 @@ sub _save_page {
my ($modspec, $modname) = @_;
# Remove $Podroot from path for cross referencing
- my $rel_path = substr($modspec, length($Podroot));
+ my $slash = $Podroot =~ m|/\z| ? 0 : 1; # Account for trailing slash
+ my $rel_path = substr($modspec, length($Podroot) + $slash);
my ($file, $dir) = fileparse($rel_path, qr/\.[^.]*/); # strip .ext
$Pages{$modname} = $dir . $file;
@@ -563,7 +564,11 @@ sub resolve_pod_page_link {
$path = $self->pages->{$to};
}
- # catdir takes care of a leading '//', so I use it here
+ # catdir takes care of a leading '//', so I use it here. Note that if I
+ # used catfile instead, not only would leading double rootdirs have to be
+ # simplified, but then $url could be relative, not absolute. In an effort
+ # to stick to the original Pod::Html, I want to keep $url absolute until
+ # the test for Htmlfileurl ne '', in which it might be relativezed.
my $url = File::Spec->catdir($self->htmlroot, $path);
if ($self->htmlfileurl ne '') {
# then $self->htmlroot eq '' (by definition of htmlfileurl) so