stas 02/04/02 23:26:25
Modified: lib DocSet.pm
lib/DocSet Doc.pm DocSet.pm RunTime.pm Util.pm
Log:
sync with DocSet:
- replaced call to `which` with a portable which function in
DocSet::Util (taken from Apache::Build in modperl-2.0 and made to
use the PATHEXT env variable on WinNT: I can re-submit this one into
the modperl-2.0 tree if you think that'll be useful, it finds the
specified file terminated by .exe, .bat, etc.. [Per Einar Ellefsen
<[EMAIL PROTECTED]>]
- use perl %ENV instead of `env` to set PERL5LIB whenh calling
docset_build. [Per Einar Ellefsen <[EMAIL PROTECTED]>]
- had to replace all regexes that used a directory/file path, and use
quotemeta() there, because the backslahes created illegal escape
sequences. [Per Einar Ellefsen <[EMAIL PROTECTED]>]
- changed some things before calling URI in DocSet::Doc; it not, the
directory name would be considered part of the host name and thus
not tried to be opened. So I replaced \ with /, as that'll open the
file correctly. [Per Einar Ellefsen <[EMAIL PROTECTED]>]
Revision Changes Path
1.5 +1 -1 modperl-docs/lib/DocSet.pm
Index: DocSet.pm
===================================================================
RCS file: /home/cvs/modperl-docs/lib/DocSet.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DocSet.pm 22 Mar 2002 02:01:51 -0000 1.4
+++ DocSet.pm 3 Apr 2002 07:26:24 -0000 1.5
@@ -1,6 +1,6 @@
package DocSet;
-$VERSION = '0.12';
+$VERSION = '0.13';
=head1 NAME
1.6 +3 -0 modperl-docs/lib/DocSet/Doc.pm
Index: Doc.pm
===================================================================
RCS file: /home/cvs/modperl-docs/lib/DocSet/Doc.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Doc.pm 22 Mar 2002 07:00:29 -0000 1.5
+++ Doc.pm 3 Apr 2002 07:26:24 -0000 1.6
@@ -72,6 +72,9 @@
# META: at this moment everything is a file path
my $src_uri = "file://" . $self->{src_path};
+ # Win32: fix the path, or it'll be parsed as hostname
+ $src_uri =~ s|\\|/|g;
+
my $u = URI->new($src_uri);
my $scheme = $u->scheme;
1.6 +3 -2 modperl-docs/lib/DocSet/DocSet.pm
Index: DocSet.pm
===================================================================
RCS file: /home/cvs/modperl-docs/lib/DocSet/DocSet.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DocSet.pm 22 Mar 2002 02:01:51 -0000 1.5
+++ DocSet.pm 3 Apr 2002 07:26:24 -0000 1.6
@@ -73,7 +73,7 @@
# cache the location of the parent node cache
if (my $parent_o = $self->get('parent_o')) {
my $parent_src_root = $parent_o->get_dir('src_root');
- (my $rel2parent_src_root = $src_root) =~ s|$parent_src_root||;
+ (my $rel2parent_src_root = $src_root) =~ s|\Q$parent_src_root||;
my $rel_dir = join '/', ("..") x ($rel2parent_src_root =~ tr|/|/|);
my $parent_cache_path = "$parent_src_root/cache.$mode.dat";
$cache->parent_node($parent_cache_path,
@@ -279,7 +279,8 @@
# # some OSs's File::Find returns files with no dir prefix root
# # (that's what ()* is for
# $dst_path =~ s/(?:$src_root)*/$dst_root/;
- $dst_path =~ s/$src_root/$dst_root/;
+# $dst_path =~ s/$src_root/$dst_root/;
+ $dst_path =~ s/\Q$src_root/$dst_root/;
# to rebuild or not to rebuild
my($should_update, $reason) =
1.4 +13 -9 modperl-docs/lib/DocSet/RunTime.pm
Index: RunTime.pm
===================================================================
RCS file: /home/cvs/modperl-docs/lib/DocSet/RunTime.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RunTime.pm 22 Mar 2002 07:00:30 -0000 1.3
+++ RunTime.pm 3 Apr 2002 07:26:24 -0000 1.4
@@ -53,25 +53,28 @@
return HAS_STORABLE;
}
-my $html2ps_exec = `which html2ps` || '';
-chomp $html2ps_exec;
+# check for existence of html2ps and ps2pdf
+
+my $html2ps_exec = which('html2ps');
sub can_create_ps {
# ps2html is bundled, so we can always create PS
- return $html2ps_exec;
+ return $html2ps_exec if $html2ps_exec;
+
+ print 'It seems that you do not have html2ps installed! You have',
+ 'to install it if you want to generate the PDF file';
+ return 0;
# if you unbundle it make sure you write here a code similar to
# can_create_pdf()
}
-my $ps2pdf_exec = `which ps2pdf` || '';
-chomp $ps2pdf_exec;
+my $ps2pdf_exec = which('ps2pdf');
sub can_create_pdf {
# check whether ps2pdf exists
return $ps2pdf_exec if $ps2pdf_exec;
- print(qq{It seems that you do not have ps2pdf installed! You have
- to install it if you want to generate the PDF file
- });
+ print 'It seems that you do not have ps2pdf installed! You have',
+ 'to install it if you want to generate the PDF file';
return 0;
}
@@ -93,9 +96,10 @@
my $rsub_skip_seen =
build_matchmany_sub([EMAIL PROTECTED]);
+ my $full_path_regex = quotemeta $full_path;
$src_docs{$rel_path} = {
map { $_ => 1 }
- map {s|$full_path/||; $_}
+ map {s|$full_path_regex/||; $_}
grep $rsub_keep_ext->($_), # get files with wanted exts
grep !$rsub_skip_seen->($_), # skip seen base dirs
@{ expand_dir($full_path) }
1.7 +23 -1 modperl-docs/lib/DocSet/Util.pm
Index: Util.pm
===================================================================
RCS file: /home/cvs/modperl-docs/lib/DocSet/Util.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Util.pm 22 Mar 2002 07:01:25 -0000 1.6
+++ Util.pm 3 Apr 2002 07:26:24 -0000 1.7
@@ -15,13 +15,15 @@
require DocSet::RunTime; # interdependency with DocSet::Util
+use constant IS_WIN32 => $^O eq 'MSWin32';
+
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(read_file read_file_paras copy_file gzip_file write_file
create_dir filename filename_ext require_package dumper
sub_trace note get_date get_timestamp proc_tmpl
build_matchmany_sub banner should_update confess cluck
- carp format_bytes expand_dir);
+ carp format_bytes expand_dir which);
# copy_file($src_path, $dst_path);
# copy a file at $src_path to $dst_path,
@@ -272,6 +274,26 @@
return [EMAIL PROTECTED];
}
+# which($short_exec_name)
+# Portable 'which' implementation.
+#
+# Parts borrowed from modperl-2.0/lib/Apache/Build.pm and modified to
+# take into account Win32 PATHEXT
+########################
+my @path_ext = ();
+if (IS_WIN32 and $ENV{PATHEXT}) {
+ @path_ext = split ';', $ENV{PATHEXT};
+}
+sub which {
+ foreach (map { catfile $_, $_[0] } File::Spec->path()) {
+ return $_ if -x;
+ if(IS_WIN32 and @path_ext) { # AFAIK, Win9x doesn't have PATHEXT
+ foreach my $ext (@path_ext) {
+ return $_.$ext if -x $_.$ext;
+ }
+ }
+ }
+}
sub dumper {
print Dumper @_;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]