in reply to Assigning to a ArrayRef accessor type
Hello tomred, and congratulations on your first post!
MockObj::files is not an array, it’s an array reference. So instead of assigning to an array variable:
my @strings = $mock->files;
you should assign to a scalar:
my $strings = $mock->files; note explain $strings; cmp_deeply($strings, bag(@list));
which gives the desired test result:
1:14 >perl 2056_SoPW.pl # [ # 'string one', # 'Different string', # 'With feeling' # ] # [ # 'string one', # 'Different string', # 'With feeling' # ] ok 1 1..1 1:14 >
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Assigning to an ArrayRef accessor type
by tobyink (Canon) on Sep 21, 2020 at 17:08 UTC | |
by tomred (Acolyte) on Sep 22, 2020 at 10:59 UTC |