http://www.perlmonks.org?node_id=1029628

darcrossito has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am new with Perl and Moo. I am trying to pass an array as attributes of a package. I read somewhere that I need to use an array ref. I want it to change the array internally. Specifically, one of the methods will be used to returned an array with one of its element changed. This is for a pacman maze. But I kept getting this error message: isa check for "maze_map" failed: Can't use string ('ArrayRefStr') as a subroutine ref while "strict refs" in use at (eval 18) line 37.

Edit: So this is my mistake. Moo has no isa. Should have checked the documentation first. And also I put Moose in the title. My bad.

Edit2: So I decided to use Moose. I have no problem right now. Will take a look if I can do similar thing like handles => { my_array => 'elements' } in Moo.

package Maze { use Moo; has 'maze_map', is => 'rw', isa => 'ArrayRef[Str]', handles => { m +y_array => 'elements' }, has 'tile_x_dim', is => 'rw', has 'tile_y_dim', is => 'rw', } my @drago = ([1,2,3],[1,3,4]); my $maze = Maze->new( maze_map => \@drago, tile_x_dim => 28, tile_y_di +m => 36 );