At 18:36 16.06.2002, Per Einar Ellefsen wrote:
At 18:17 16.06.2002, Stas Bekman wrote:
Per Einar Ellefsen wrote:
Ok, thanks a lot Stas, but that broke all links on Win32 :)
well, not that, but extra fixing on top of the index.html fix :) the
s|$base/|| was obviously not crossplatform (notice the trailing /), so I
thought abs2rel is the only way to do that well. I guess I could use
substr() on the first char, but who knows what separators are out there.
I tracked it down to a bug in File::Spec::Win32::abs2rel , which is
fixed by the attached patch. I'm not sure if I understood the abs2rel
code well enough to submit a patch to p5p though... I'm afraid of
breaking other things :(
Doh! Too bad :( I don't like the idea of compensating for bugs in the
code, especially when the bug fix is applied globally (without checking
$^O eq 'MSWin32'). How about putting an abs2rel in Util.pm and do all the
bug fixing there? Though we should use the fqdn call then, so later it
won't be confused with File::Spec's abs2rel.
Yes, that would probably be better. My fix doesn't break other platforms
though (uhm, don't know about MacOS), because it only removed \w with a
colon after it, at the beginning of string. Anyway, I'll do this in Util.pm.
Here's the patch.
--
Per Einar Ellefsen
[EMAIL PROTECTED]
Index: lib/DocSet/RunTime.pm
===================================================================
RCS file: /home/cvs/modperl-docs/lib/DocSet/RunTime.pm,v
retrieving revision 1.8
diff -u -r1.8 RunTime.pm
--- lib/DocSet/RunTime.pm 15 Jun 2002 18:20:33 -0000 1.8
+++ lib/DocSet/RunTime.pm 16 Jun 2002 22:26:57 -0000
@@ -6,7 +6,7 @@
use strict;
use warnings;
-use File::Spec::Functions qw(catdir catfile splitdir abs2rel);
+use File::Spec::Functions qw(catdir catfile splitdir);
use File::Find;
use DocSet::Util;
@@ -102,7 +102,7 @@
my $rel_uri = path2uri($rel_path);
$src_docs{$rel_uri} = {
map { s/config\.cfg$/index.html/; ($_ => 1) } # autogenerated
index.html
- map path2uri( abs2rel($_, $full_base_path) ), # full
path=>relative uri
+ map path2uri( DocSet::Util::abs2rel($_, $full_base_path) ),# full
path=>relative uri
grep $rsub_keep_ext->($_), # get files with wanted exts
grep !$rsub_skip_seen->($_), # skip seen base dirs
@{ expand_dir($full_base_path) }
Index: lib/DocSet/Util.pm
===================================================================
RCS file: /home/cvs/modperl-docs/lib/DocSet/Util.pm,v
retrieving revision 1.12
diff -u -r1.12 Util.pm
--- lib/DocSet/Util.pm 11 Jun 2002 15:02:10 -0000 1.12
+++ lib/DocSet/Util.pm 16 Jun 2002 22:26:57 -0000
@@ -11,6 +11,7 @@
use Data::Dumper;
use Carp;
use Template;
+use File::Spec;
use File::Spec::Functions;
require DocSet::RunTime; # interdependency with DocSet::Util
@@ -135,6 +136,18 @@
return unless defined $_[0];
return join '/', File::Spec->splitdir(shift);
}
+
+# we would use abs2rel from File::Spec directly; however, that one has
+# a bug in File::Spec 1.20 on Win32. Fix it here.
+# Make sure to call this function as DocSet::Util::abs2rel, to avoid
+# confusion
+
+sub abs2rel {
+ my $res = File::Spec->abs2rel(@_);
+ $res =~ s/^[a-zA-Z]:// if IS_WIN32;
+ $res;
+}
+
sub get_date {
sprintf "%s %d, %d", (split /\s+/, scalar localtime)[1,2,4];
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]