CC: | stevan [...] iinteractive.com, amahabal [...] gmail.com |
Subject: | A bug in splice in MooseX::AttributeHelpers::MethodProvider::Array |
When I run bug.pl, I get:
amahabal@zunjar:~/s2$ perl bug.pl
Can't locate object method "Accessor=HASH(0x87425e8)" via package
"Moose::Meta::Method" at
/usr/local/lib/perl5/site_perl/5.10.0/MooseX/AttributeHelpers/MethodProvider/Array.pm
line 128.
The following small change to the errant file fixes the problem:
===========
Line 128 is currently
CORE::splice @{$self->$reader()}, $i, $j, @elems;
however, it should instead contain C<$reader->($self)>.
Likewise on line 134.
===========
Other corresponding pieces of the file already look like $reader->($self).
Thanks,
Abhijit
Subject: | bug.pl |
package Bug;
use 5.010;
use strict;
use warnings;
use Moose;
use MooseX::AttributeHelpers;
use version; our $VERSION = qv('0.01');
has 'codelets' => (
metaclass => 'Collection::Array',
is => 'ro',
isa => 'ArrayRef[Int]',
default => sub { [] },
provides => { splice => 'splice_codelet' }
);
no Moose;
__PACKAGE__->meta->make_immutable;
package main;
my $bug = Bug->new(codelets => [2, 3, 4]);
say $bug->splice_codelet(1, 1);
1;