Hello all,
This is really strange. I am trying to use Moose::Autobox in a class. I
can't seem to figure out what I am doing wrong. Here's my code (way
simplified):
package Foo;
use Moose;
use Method::Signatures;
use Moose::Autobox;
method foo {
my $data = {
foo => 1,
bar => 2,
};
return {
[ %{$data}->values->map->(sub { $_ + 1 }) ]
};
}
no Moose;
__PACKAGE__->meta->make_immutable;
And then here's my test code for the test:
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 2;
BEGIN { use_ok 'Foo' };
my $foo = Foo->new();
is_deeply $foo->foo, [ 2, 3 ], 'test';
Yet when I run the test I get this error:
Can't call method "values" without a package or object reference at Foo.pm
line 12.
Yet this sanity test works fine:
use Moose::Autobox;
use strict;
use warnings;
use feature ':5.10';
say { one => 1, two => 2 }->values->map(sub { $_ + 1 })->join(', ');
Does anyone see what I am doing wrong?
Thanks!
--
fREW Schmidt
http://blog.afoolishmanifesto.com