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
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1264739815-18078-24"
Content-Length: 0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 169
Download (untitled) / with headers
text/plain 169b
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
MIME-Version: 1.0
Content-Type: text/x-patch; name="cache-contains_pod.patch"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline; filename="cache-contains_pod.patch"
Content-Transfer-Encoding: binary
Content-Length: 815
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 {
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-18076-1264740112-1122.54109-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 73
Thank you. I hope one of the committers can get to this before too long.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.