From: Craig A. Berry Date: Tue, 27 Dec 2005 17:59:35 +0000 (-0600) Subject: fortify Pod::Simple::Search against non-case-preserving filesystems X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=046e7abe286b1ec22985c2efe9353fc0ac6dd6f3;p=p5sagit%2Fp5-mst-13.2.git fortify Pod::Simple::Search against non-case-preserving filesystems From: "Craig A. Berry" Message-id: <43B1D567.9080504@mac.com> p4raw-id: //depot/perl@26519 --- diff --git a/lib/Pod/Simple/Search.pm b/lib/Pod/Simple/Search.pm index 0476042..2fcd5da 100644 --- a/lib/Pod/Simple/Search.pm +++ b/lib/Pod/Simple/Search.pm @@ -4,7 +4,7 @@ package Pod::Simple::Search; use strict; use vars qw($VERSION $MAX_VERSION_WITHIN $SLEEPY); -$VERSION = 2.03; ## Current version of this package +$VERSION = 2.03_01; ## Current version of this package BEGIN { *DEBUG = sub () {0} unless defined &DEBUG; } # set DEBUG level use Carp (); @@ -67,14 +67,7 @@ sub survey { $try = File::Spec->catfile( $cwd ,$try); } # simplify path - # on VMS canonpath will vmsify:[the.path], but File::Find::find - # wants /unixy/paths - # (Is that irrelevent now htat we don't use File::Find? -- SMB) - if( $^O eq 'VMS' ) { - $try = VMS::Filespec::unixify($try); - } else { - $try = File::Spec->canonpath($try); - } + $try = File::Spec->canonpath($try); my $start_in; my $modname_prefix; @@ -243,9 +236,11 @@ sub _path2modname { # * remove e.g. "i586-linux" (from 'archname') # * remove e.g. 5.00503 # * remove pod/ if followed by perl*.pod (e.g. in pod/perlfunc.pod) + # * dig into the file for case-preserved name if not already mixed case my @m = @$modname_bits; my $x; + my $verbose = $self->verbose; # Shaving off leading naughty-bits while(@m @@ -258,6 +253,36 @@ sub _path2modname { my $name = join '::', @m, $shortname; $self->_simplify_base($name); + + if ($name eq lc($name) || $name eq uc($name)) { + open PODFILE, "<$file" or die "_path2modname: Can't open $file: $!"; + my $in_pod = 0; + my $in_name = 0; + while () { + chomp; + $in_pod = 1 if m/^=\w/; + $in_pod = 0 if m/^=cut/; + next unless $in_pod; # skip non-pod text + next if m/^\s*\z/; # and blank lines + next if ($in_pod && m/^X( $i_full, $i, 0, $modname_bits ); } elsif(-d _) { + $i =~ s/\.DIR\z//i if $^O eq 'VMS'; $_ = $i; my $rv = $callback->( $i_full, $i, 1, $modname_bits ) || ''; diff --git a/lib/Pod/Simple/t/other_test_lib/squaa/Wowo.pod b/lib/Pod/Simple/t/other_test_lib/squaa/Wowo.pod index 98e7624..e2c9d5d 100644 --- a/lib/Pod/Simple/t/other_test_lib/squaa/Wowo.pod +++ b/lib/Pod/Simple/t/other_test_lib/squaa/Wowo.pod @@ -1,7 +1,7 @@ =head1 NAME -squaa::Glunk -- blorpoesu +squaa::Wowo -- blorpoesu =head1 DESCRIPTION