[SCM] libtype-tiny-perl Debian packaging branch, master, updated. debian/0.016-1-48-ga7f6748

Toby Inkster mail at tobyinkster.co.uk
Mon Jul 29 12:55:06 UTC 2013


The following commit has been merged in the master branch:
commit c314785bd29972ce6a68c94bf1b1e461a417519d
Author: Toby Inkster <mail at tobyinkster.co.uk>
Date:   Tue Jul 23 16:57:35 2013 +0100

    make closures really really really work

diff --git a/lib/Eval/TypeTiny.pm b/lib/Eval/TypeTiny.pm
index 154b853..ff12cd5 100644
--- a/lib/Eval/TypeTiny.pm
+++ b/lib/Eval/TypeTiny.pm
@@ -59,12 +59,7 @@ sub eval_closure
 	my $source    = join "\n" => (
 		"package Eval::TypeTiny::Sandbox$sandbox;",
 		"sub {",
-		map(
-			HAS_LEXICAL_SUBS
-				? _make_lexical_assignment($_, $i++)
-				: sprintf('my %s = %s{$_[%d]};', $_, substr($_, 0, 1), $i++),
-			@keys
-		),
+		map(_make_lexical_assignment($_, $i++), @keys),
 		$src,
 		"}",
 	);
@@ -84,7 +79,6 @@ sub eval_closure
 	return $compiler->(@{$args{environment}}{@keys});
 }
 
-HAS_LEXICAL_SUBS and eval <<'SUPPORT_LEXICAL_SUBS';
 my $tmp;
 sub _make_lexical_assignment
 {
@@ -99,9 +93,14 @@ sub _make_lexical_assignment
 			"my $tmpname = \$_[$index];".
 			"my sub $name { goto $tmpname };";
 	}
-	sprintf('my %s = %s{$_[%d]};', $key, substr($key, 0, 1), $index);
+	
+	sprintf(
+		'our %s; *%s = $_[%d];',
+		$key,
+		substr($key, 1),
+		$index,
+	);
 }
-SUPPORT_LEXICAL_SUBS
 
 1;
 

-- 
libtype-tiny-perl Debian packaging



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