Skip to content

Commit

Permalink
drop support for ${^TYPE_PARAMS_MULTISIG}. use ${^_TYPE_PARAMS_MULTIS…
Browse files Browse the repository at this point in the history
…IG} instead
  • Loading branch information
tobyink committed Sep 7, 2024
1 parent 4bd2db9 commit c804cda
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions lib/Type/Params.pm
Original file line number Diff line number Diff line change
Expand Up @@ -937,8 +937,8 @@ So C<< signature( multi => [...] ) >> can be used instead of the longer
C<< signature( multiple => [...] ) >>. Three whole keystrokes saved!
(B<Note:> in older releases of Type::Params, C<< ${^_TYPE_PARAMS_MULTISIG} >>
was called C<< ${^TYPE_PARAMS_MULTISIG} >>. The latter name is deprecated,
and support for it will be removed in a future release of Type::Params.)
was called C<< ${^TYPE_PARAMS_MULTISIG} >>. The latter name is no longer
supported.)
=head4 C<< message >> B<Str>
Expand Down
5 changes: 2 additions & 3 deletions lib/Type/Params/Alternatives.pm
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ sub _coderef_start_extra {
my ( $self, $coderef ) = ( shift, @_ );

$coderef->add_line( 'my $r;' );
$coderef->add_line( 'undef ${^TYPE_PARAMS_MULTISIG};' );
$coderef->add_line( 'undef ${^_TYPE_PARAMS_MULTISIG};' );
$coderef->add_gap;

Expand Down Expand Up @@ -127,7 +126,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} = ${^_TYPE_PARAMS_MULTISIG} = %d }%sif ( %s );',
'eval { local @_ = @_; $r = [ %s ]; ${^_TYPE_PARAMS_MULTISIG} = %d }%sif ( %s );',
$alt_code,
$meta->{_index},
"\n\t",
Expand All @@ -139,7 +138,7 @@ sub _coderef_meta_alternative {

my $callback_var = $coderef->add_variable( '$signature', \$meta->{closure} );
$coderef->add_line( sprintf(
'eval { $r = [ %s->(@_) ]; ${^TYPE_PARAMS_MULTISIG} = ${^_TYPE_PARAMS_MULTISIG} = %d }%sif ( %s );',
'eval { $r = [ %s->(@_) ]; ${^_TYPE_PARAMS_MULTISIG} = %d }%sif ( %s );',
$callback_var,
$meta->{_index},
"\n\t",
Expand Down
2 changes: 1 addition & 1 deletion t/20-modules/Type-Params/multisig-custom-message.t
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ for my $test ( @tests ) {
no warnings 'uninitialized';
my($name, $code, $expected, $sig) = @$test;
like( exception { $code->() } || '', qr/\A\Q$expected/, $name );
is ${^TYPE_PARAMS_MULTISIG}, $sig, "$name \${^TYPE_PARAMS_MULTISIG}";
is ${^_TYPE_PARAMS_MULTISIG}, $sig, "$name \${^_TYPE_PARAMS_MULTISIG}";
}

done_testing;
20 changes: 10 additions & 10 deletions t/20-modules/Type-Params/multisig.t
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ is_deeply(
);

is(
${^TYPE_PARAMS_MULTISIG},
${^_TYPE_PARAMS_MULTISIG},
0,
'...${^TYPE_PARAMS_MULTISIG}',
'...${^_TYPE_PARAMS_MULTISIG}',
);

is_deeply(
Expand All @@ -58,9 +58,9 @@ is_deeply(
);

is(
${^TYPE_PARAMS_MULTISIG},
${^_TYPE_PARAMS_MULTISIG},
0,
'...${^TYPE_PARAMS_MULTISIG}',
'...${^_TYPE_PARAMS_MULTISIG}',
);

like(
Expand All @@ -76,9 +76,9 @@ is_deeply(
);

is(
${^TYPE_PARAMS_MULTISIG},
${^_TYPE_PARAMS_MULTISIG},
1,
'...${^TYPE_PARAMS_MULTISIG}',
'...${^_TYPE_PARAMS_MULTISIG}',
);

is_deeply(
Expand All @@ -88,9 +88,9 @@ is_deeply(
);

is(
${^TYPE_PARAMS_MULTISIG},
${^_TYPE_PARAMS_MULTISIG},
1,
'...${^TYPE_PARAMS_MULTISIG}',
'...${^_TYPE_PARAMS_MULTISIG}',
);

like(
Expand All @@ -106,9 +106,9 @@ is_deeply(
);

is(
${^TYPE_PARAMS_MULTISIG},
${^_TYPE_PARAMS_MULTISIG},
2,
'...${^TYPE_PARAMS_MULTISIG}',
'...${^_TYPE_PARAMS_MULTISIG}',
);

like(
Expand Down

0 comments on commit c804cda

Please sign in to comment.