From: Vincent Pit Date: Sat, 28 Jul 2012 17:22:11 +0000 (+0200) Subject: Only call _parse_version_expression() for lines that contain VERSION X-Git-Tag: release_1.0.10~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9922478ce1c1a928a0936fcf7cda1962c2f404da;p=p5sagit%2FModule-Metadata.git Only call _parse_version_expression() for lines that contain VERSION This saves a method call for each source line that does not contain 'VERSION', yielding a whopping 30% speedup for _parse_fh(). --- diff --git a/lib/Module/Metadata.pm b/lib/Module/Metadata.pm index 4fad0f3..a7e7234 100644 --- a/lib/Module/Metadata.pm +++ b/lib/Module/Metadata.pm @@ -488,7 +488,9 @@ sub _parse_fh { # parse $line to see if it's a $VERSION declaration my( $vers_sig, $vers_fullname, $vers_pkg ) = - $self->_parse_version_expression( $line ); + ($line =~ /VERSION/) + ? $self->_parse_version_expression( $line ) + : (); if ( $line =~ $PKG_REGEXP ) { $pkg = $1;