summaryrefslogtreecommitdiff
path: root/lib/Type/Params
diff options
context:
space:
mode:
authorToby Inkster <mail@tobyinkster.co.uk>2022-09-18 15:12:25 +0100
committerToby Inkster <mail@tobyinkster.co.uk>2022-09-18 15:12:25 +0100
commit86919ca9a37e34317b10f52b5203fcdd8ed018bd (patch)
tree58073bdfda4b84d235c444580b03000b31cc202d /lib/Type/Params
parentac87df7e2554235d412091588f3d3a0b330fa094 (diff)
Rename the global variable used to indicate which signature succeeded in multisigs (issue #120)
Diffstat (limited to 'lib/Type/Params')
-rw-r--r--lib/Type/Params/Alternatives.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Type/Params/Alternatives.pm b/lib/Type/Params/Alternatives.pm
index 3a14a9e0..7d16e77b 100644
--- a/lib/Type/Params/Alternatives.pm
+++ b/lib/Type/Params/Alternatives.pm
@@ -96,6 +96,7 @@ sub _coderef_start_extra {
$coderef->add_line( 'my $r;' );
$coderef->add_line( 'undef ${^TYPE_PARAMS_MULTISIG};' );
+ $coderef->add_line( 'undef ${^_TYPE_PARAMS_MULTISIG};' );
$coderef->add_gap;
for my $meta ( @{ $self->meta_alternatives } ) {
@@ -124,7 +125,7 @@ sub _coderef_meta_alternative {
my $alt_code = $meta->{source};
$alt_code =~ s/^sub [{]/do {/;
$coderef->add_line( sprintf(
- 'eval { local @_ = @_; $r = [ %s ]; ${^TYPE_PARAMS_MULTISIG} = %d }%sif ( %s );',
+ 'eval { local @_ = @_; $r = [ %s ]; ${^TYPE_PARAMS_MULTISIG} = ${^_TYPE_PARAMS_MULTISIG} = %d }%sif ( %s );',
$alt_code,
$meta->{_index},
"\n\t",
@@ -136,7 +137,7 @@ sub _coderef_meta_alternative {
my $callback_var = $coderef->add_variable( '$signature', \$meta->{closure} );
$coderef->add_line( sprintf(
- 'eval { $r = [ %s->(@_) ]; ${^TYPE_PARAMS_MULTISIG} = %d }%sif ( %s );',
+ 'eval { $r = [ %s->(@_) ]; ${^TYPE_PARAMS_MULTISIG} = ${^_TYPE_PARAMS_MULTISIG} = %d }%sif ( %s );',
$callback_var,
$meta->{_index},
"\n\t",