Subject: | CPAN's o conf init/FirstTime.pm: trailing backslash in cpan_home directory path |
During initial manual configuration of CPAN, when asked the question
CPAN build and cache directory?
answer with a path with a trailing backslash, e.g. C:\vanilla-
perl\.cpan\
Later exit and try to restart CPAN:
Show quoted text
> cpan
CPAN: File::HomeDir loaded ok
Error while requiring CPAN::Config:
Can't find string terminator "]" anywhere before EOF at C:/vanilla-
perl/perl/lib/CPAN/Config.pm line 13.
Compilation failed in require at C:/vanilla-perl/perl/site/lib/CPAN/
HandleConfig.pm line 385.
Show quoted text > head -13 C:/vanilla-perl/perl/lib/CPAN/Config.pm|tail -1
'cpan_home' => q[C:\vanilla-perl\.cpan\],
The trailing backslash escapes the delimiter and creates a syntax
error. This is always reproducable for the latest release of CPAN:
Show quoted text > perl -MCPAN -e"print $CPAN::VERSION"
1.8755
Patch for FirstTime.pm follows:
--- FirstTime.pm~ Sun Jul 23 16:15:06 2006
+++ FirstTime.pm Mon Aug 14 11:19:19 2006
@@ -140,6 +140,10 @@
. "or directory is not writable. Please retry.\n";
}
}
+ {
+ local $/ = '\\'; # single backslash
+ chomp $ans; # remove trailing backslash if existent
+ }
$CPAN::Config->{cpan_home} = $ans;
$CPAN::Frontend->myprint($prompts{keep_source_where});