in reply to Parsing form post (content)

CGI will do this fine:

use CGI qw(:standard); # import so no objects my $data = [Vars];

Update: Some explanation. CGI's Vars() method returns a hash of field-value pairs in list context, which it gets from the arrayref brackets in the $data assignment. The hash gets flattened and $data becomes an arrayref as you wanted. Watch out for multivalued data, it comes in a packed format that you may have to predigest for your test application.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Parsing form post (content)
by mp (Deacon) on Aug 29, 2002 at 19:19 UTC
    Thank you for the quick response, that worked. Here's the code in context:
    sub test_submit { my ($html_content, $click, %values) = @_; my $base_url = 'http://test.com/'; ok(my @form_list = HTML::Form->parse($html_content, $base_url)); my $form = $form_list[0]; for (keys %values) { $form->value($_, $values{$_}); } my $request = $form->click($click); my $rcontent = $request->content; ######### BEGIN parse POST DATA ######### use CGI qw(:cgi-std); my $q = CGI->new($rcontent); my $data = [$q->Vars()]; ######### END parse POST DATA ######### use Data::Dumper; warn Dumper($data); }