I'm having some problems creating a map with maps with arrays with maps. Its kind of complicated to explain, but it seems like it should be pretty easy to do. However, I'm having problems all over the place. Its going to be clear that I'm a perl-tard.
sub test_arg_maps {
my %test_args;
$test_args{"post_1"}{post} = q({"template_name": "unnamed_template_1", "template_subject":"unnamed_subject_1", "template_body":"body_1"});
$test_args{"post_1"}{user} = q(x-idm test:[email protected]);
$test_args{"post_1"}{save} = q(post_1);
$test_args{"get_1"}{user} = q(x-idm test:[email protected]);
$test_args{"get_1"}{save} = q(u0_template_get_1);
$test_args{"u0_1"}{user} = q(x-idm test:[email protected]);
my @param_array = ();
push(@param_array, (parameters => q(filter={"query":[]}), save => q(empty_filter)));
push(@param_array, (parameters => q(filter={"query":[{"and":[]}]}), save => q(just_and)));
$test_args{"u0_1"}{params} = @param_array;
return %test_args;
}
The code that uses this function is:
my %test_args = test_arg_maps();
my @u0_1_array = $test_args{"u0_1"}{params};
for my $i (@u0_1_array)
{
my %param_map = %{$i}; ## LINE 63
$http->run(qq(
/v1/template.aspx?$param_map{"parameters"} - Reject $test_args{"u0_1"}{user} ( callback => [qw(save_page $param_map{"save"} \$self->filter_json)]);
));
}
The error I get is:
ERROR at SIT::Harness (line 73): Can't use string ("4") as a HASH ref while "strict refs" in use at test.pl line 63.
EDIT: I've labeled line 63 above, its the first line in the for block.
I've tried several different ways to access these things, but they all give me errors which essentially tell me I don't have a hash where I'm looking for one.
Thanks for your help.