Skip Menu |

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 54109
Status: open
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: gfuji [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] Improve Module::Build::Base::contains_pod(), which is a bottleneck
Hi, xdg. I have wrtie a patch to improve Module::Build::Base::contains_pod(), which is a bottleneck in the Build script. Regards, -- Goro Fuji (gfx) GFUJI at CPAN.org
Subject: cache-contains_pod.patch
Index: lib/Module/Build/Base.pm =================================================================== --- lib/Module/Build/Base.pm (revision 13772) +++ lib/Module/Build/Base.pm (working copy) @@ -3127,14 +3127,18 @@ sub contains_pod { my ($self, $file) = @_; - return '' unless -T $file; # Only look at text files + return $self->{_contains_pod}{$file} + if exists $self->{_contains_pod}{$file}; + + return $self->{_contains_pod}{$file} = '' if !-f $file; + my $fh = IO::File->new( $file ) or die "Can't open $file: $!"; - while (my $line = <$fh>) { - return 1 if $line =~ /^\=(?:head|pod|item)/; - } + binmode $fh; # for Win32 + local $/ = undef; # slurp - return ''; + return $self->{_contains_pod}{$file} + = <$fh> =~ /^ = (?: head | pod | item ) /xms; } sub ACTION_html {
Thank you. I hope one of the committers can get to this before too long.