Also documented, also added to the tests.
This file documents the revision history for Perl extension HTTP::Body.
+1.11 Tue 26 Oct 2010 14:10:00 UTC
+ - Added param_order capability (Torsten Raudssus [GETTY])
+
1.10 Fri 8 Oct 2010 15:50:55 UTC
- Patch for test failure ( thanks KENTNL/MITHALDU! )
name = HTTP-Body
-version = 1.10
+version = 1.11
author = Christian Hansen, C<chansen@cpan.org>
author = Sebastian Riedel, C<sri@cpan.org>
author = Andy Grundman, C<andy@hybridized.org>
$body->add($buffer);
}
- my $uploads = $body->upload; # hashref
- my $params = $body->param; # hashref
- my $body = $body->body; # IO::Handle
+ my $uploads = $body->upload; # hashref
+ my $params = $body->param; # hashref
+ my $param_order = $body->param_order # arrayref
+ my $body = $body->body; # IO::Handle
}
=head1 DESCRIPTION
content_type => $content_type,
length => 0,
param => {},
+ param_order => [],
state => 'buffering',
upload => {},
tmpdir => File::Spec->tmpdir(),
else {
$self->{param}->{$name} = $value;
}
+
+ push @{$self->{param_order}}, $name;
}
return $self->{param};
return $self->{tmpdir};
}
+=item param_order
+
+Returns the array ref of the param keys in the order how they appeared on the body
+
+=cut
+
+sub param_order {
+ return shift->{param_order};
+}
+
=back
=head1 SUPPORT
Christian Walde
+Torsten Raudssus <torsten@raudssus.de>
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 140;
+use Test::More tests => 153;
use Test::Deep;
use Cwd;
$results->{upload}->{$field}->{tempname} = ignore();
}
}
-
+
cmp_deeply( $body->body, $results->{body}, "$test MultiPart body" );
cmp_deeply( $body->param, $results->{param}, "$test MultiPart param" );
+ cmp_deeply( $body->param_order, $results->{param_order} ? $results->{param_order} : [], "$test MultiPart param_order" );
cmp_deeply( $body->upload, $results->{upload}, "$test MultiPart upload" )
if $results->{upload};
cmp_ok( $body->state, 'eq', 'done', "$test MultiPart state" );
for my $temp ( @temps ) {
ok( !-e $temp, "Temp file $temp was deleted" );
}
+
}
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 31;
+use Test::More tests => 37;
use Cwd;
use Digest::MD5 qw(md5_hex);
is_deeply( $body->body, $results->{body}, "$test UrlEncoded body" );
is_deeply( $body->param, $results->{param}, "$test UrlEncoded param" );
+ is_deeply( $body->param_order, $results->{param_order} ? $results->{param_order} : [], "$test UrlEncoded param_order" );
is_deeply( $body->upload, $results->{upload}, "$test UrlEncoded upload" );
cmp_ok( $body->state, 'eq', 'done', "$test UrlEncoded state" );
cmp_ok( $body->length, '==', $body->content_length, "$test UrlEncoded length" );
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 12;
+use Test::More tests => 14;
use Cwd;
use HTTP::Body;
is_deeply( $body->body, $results->{body}, "$test XForms body" );
is_deeply( $body->param, $results->{param}, "$test XForms param" );
+ is_deeply( $body->param_order, $results->{param_order} ? $results->{param_order} : [], "$test XForms param_order" );
is_deeply( $body->upload, $results->{upload}, "$test XForms upload" );
if ( $body->isa('HTTP::Body::XFormsMultipart') ) {
cmp_ok( $body->start, 'eq', $results->{start}, "$test XForms start" );
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea", "encoding"
+ ]
}
"param" => {
"one" => "foo",
"two" => "bar"
- }
+ },
+ "param_order" => [
+ "one", "two"
+ ],
}
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea", "encoding"
+ ]
}
"param" => {
"one" => "foo",
"two" => "bar"
- }
+ },
+ "param_order" => [
+ "one", "two"
+ ]
}
"param" => {
"one" => "foo",
"two" => "bar"
- }
+ },
+ "param_order" => [
+ "one", "two"
+ ]
}
"param" => {
"one" => "foo",
"two" => "bar=bam"
- }
+ },
+ "param_order" => [
+ "one", "two"
+ ]
}
"param" => {
"XForms:Model" => "<model><data1>asdfg</data1><data2>asdfg</data2></model>"
},
+ param_order => [
+ "XForms:Model"
+ ],
"start" => "asdfg\@asdfg.com"
}
"upload" => {},
"param" => {
"XForms:Model" => "<model><data1>asdfg</data1><data2>asdfg</data2></model>"
- }
+ },
+ param_order => [
+ "XForms:Model"
+ ]
}