Skip Menu |

This queue is for tickets about the Type-Tiny CPAN distribution.

Report information
The Basics
Id: 90096
Status: resolved
Priority: 0/
Queue: Type-Tiny

People
Owner: perl [...] toby.ink
Requestors: SKAUFMAN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.032
Fixed in: (no value)



Subject: Modification of a read-only value attempted at parameter validation for '__ANON__'
Heya, so the following test fails: use strict; use warnings FATAL=> 'all'; use Test::More; use Type::Params qw[ compile ]; use Types::Standard qw[ slurpy Dict Bool ]; use Data::Dumper::Concise; my $check = compile( slurpy Dict [ with_connection => Bool, ], ); #diag Dumper($check); for (qw[ 1 2 3 ]) { ok $check->( with_connection=> 1, ); } The issue is some generated code: $_ = ($#_ - 0) % 2 == 0 ? 'Error::TypeTiny::WrongNumberOfParameters'->throw('message', 'Odd number of element in Dict[with_connection=>Bool]') : {@_[0 .. $#_]}; $_ is not localized, and fails when assigning to it.
Thanks; I've added a very slightly modified copy of this test to the test suite (I hope that's OK): https://github.com/tobyink/p5-type-tiny/commit/1e794e1afbdcece0b7604ea4026d602e4901cc7a And I've pushed a change that seems to fix it: https://github.com/tobyink/p5-type-tiny/commit/1d4d2ce5b1bd3e8c44e06f1affca48f25fa51b64 I'm marking this issue as "patched" until there's a stable release including the fix. Feel free to re-open the issue if you don't think this solves it.
Great, much appreciated.
On Wed Nov 06 15:47:04 2013, TOBYINK wrote: Show quoted text
> Thanks; I've added a very slightly modified copy of this test to the > test suite (I hope that's OK):
Here's another test which exhibits a different symptom of the same bug (non-localized $_ causes "spooky action at a distance") which is what bit me. Might be useful.
Subject: slurpy-localized.pl
use strict; use warnings; use Type::Params qw[ compile ]; use Types::Standard -all; use Test::More; { my $check = compile( Dict [ a => Num ] ); grep { $_->( { a => 3 } ) } $check; is( ref $check, 'CODE', "check is still code" ); } { my $check = compile( slurpy Dict [ a => Num ] ); grep { $_->( a => 3 ) } $check; is( ref $check, 'CODE', "slurpy check is still code" ); } done_testing;
Diab's script should already pass in recent developer releases, but just to make sure that it continues to, I've added it to the test suite.
Fixed in 0.034.