|
I can boil down the failure to:
use Attribute::Types qw(SCALAR);
my $x : SCALAR;
$x = \7;
This returns:
Cannot assign SCALAR(0x506380) to SCALAR variable at scalar.t line 3
In the debugger:
Attribute::Types::reference::STORE(/Attribute-Types-0.10/blib/lib/Attribute/Types.pm:123):
123: ref($val) && ref($val)->isa($self->{type})
124: or croak "Cannot assign $value to $type variable" ;
DB<2> print ref($val)
SCALAR
DB<3> print $self->{type}
SCALAR
DB<4> print ref($val)->isa($self->{type})
The following patch, allows the above to run without croaking, and all the test cases now pass.
==== Attribute-Types-0.10/lib/Attribute/Types.pm#1 - Attribute-Types-0.10/lib/Attribute/Types.pm ==
+==
123c123,124
< ref($val) && ref($val)->isa($self->{type})
---
> ref($val) && (ref($val)->isa($self->{type})
> || (ref($val) eq $self->{type}))
I'm beginning to to think this is a bug.
Peter (Stig) Edwards
|