[libtype-tiny-perl] 03/07: only load Text::Balanced if we really need it (rarely)

Jonas Smedegaard dr at jones.dk
Wed Oct 29 19:42:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 1.001_001
in repository libtype-tiny-perl.

commit 6f1c0fa8d71db1dad51ff2f045268a2f463ada41
Author: Toby Inkster <mail at tobyinkster.co.uk>
Date:   Tue Sep 9 09:27:02 2014 +0100

    only load Text::Balanced if we really need it (rarely)
---
 lib/Type/Parser.pm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/Type/Parser.pm b/lib/Type/Parser.pm
index f0ddc81..7fb2759 100644
--- a/lib/Type/Parser.pm
+++ b/lib/Type/Parser.pm
@@ -343,7 +343,6 @@ Evaluate: {
 	Type::Parser::TokenStream;
 	
 	use Scalar::Util qw(looks_like_number);
-	use Text::Balanced qw(extract_quotelike);
 	
 	sub new
 	{
@@ -454,9 +453,13 @@ Evaluate: {
 			return $punctuation{$spelling};
 		}
 		
-		if (my $quotelike = extract_quotelike $self->{remaining})
+		if ($self->{remaining} =~ /\A\s*[q'"]/sm)
 		{
-			return bless([ Type::Parser::QUOTELIKE, $quotelike ], "Type::Parser::Token"),;
+			require Text::Balanced;
+			if (my $quotelike = Text::Balanced::extract_quotelike($self->{remaining}))
+			{
+				return bless([ Type::Parser::QUOTELIKE, $quotelike ], "Type::Parser::Token"),;
+			}
 		}
 		
 		if ($self->{remaining} =~ /^([+-]?[\w:.+]+)/sm)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libtype-tiny-perl.git



More information about the Pkg-perl-cvs-commits mailing list