From ccbc72835d4d55430db838ce5b46680f5d9966bc Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 7 Nov 2011 13:03:09 +0100 Subject: [PATCH] In pod/buildtoc, chdir to the top level of the source tree before running. Originally buildtoc called chdir to ensure it ran from the pod/ directory. However, this caused problems when the environment is set to honour UTF-8 locales, and the regex engine (attempts to) demand-load UTF-8 swashes, because on *nix and VMS buildtoc is invoked with a relative path in @INC. d5e2eea989a69524 fixed this by avoiding the chdir. However, an equally valid solution is to run from the top level of the source tree, because the actual use cases only have relative paths in @INC when invoked from the top level, with absolute paths in @INC for the use cases that invoke perltoc from other directories. Hence, it's always safe to change to the top level of the source tree. This permits future simplification and refactoring. --- pod/buildtoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pod/buildtoc b/pod/buildtoc index 96163c4..c0c9a91 100644 --- a/pod/buildtoc +++ b/pod/buildtoc @@ -15,8 +15,11 @@ use Carp; no locale; require 5.010; +# Assumption is that we're either already being run from the top level (*nix, +# VMS), or have absolute paths in @INC (Win32, pod/Makefile) { my $Top = File::Spec->catdir($FindBin::Bin, File::Spec->updir); + chdir $Top or die "Can't chdir to $Top: $!"; sub abs_from_top { my $path = shift; -- 2.7.4