Permalink
Browse files

Optimize POD section handling in check_install()

By refactoring the regexps used to determine whether we are in POD, we can
save about 10% of the time spent in check_install() when CPANPLUS looks for
modules to update (check_install() being the bottleneck).
  • Loading branch information...
1 parent 4fddb14 commit 266af4c5db37e082239072bbc253fa37aa5d4b42 @vpit vpit committed Apr 25, 2012
Showing with 3 additions and 4 deletions.
  1. +3 −4 lib/Module/Load/Conditional.pm
View
7 lib/Module/Load/Conditional.pm
@@ -254,14 +254,13 @@ sub check_install {
my $in_pod = 0;
while ( my $line = <$fh> ) {
- ### stolen from EU::MM_Unix->parse_version to address
### #24062: "Problem with CPANPLUS 0.076 misidentifying
### versions after installing Text::NSP 1.03" where a
### VERSION mentioned in the POD was found before
### the real $VERSION declaration.
- $in_pod = $line =~ /^=(?!cut)/ ? 1 :
- $line =~ /^=cut/ ? 0 :
- $in_pod;
+ if( $line =~ /^=(.{0,3})/ ) {
+ $in_pod = $1 ne 'cut';
+ }
next if $in_pod;
### try to find a version declaration in this string.

0 comments on commit 266af4c

Please sign in to comment.