[Catalyst-commits] r13662 - in trunk/HTTP-Body: . lib/HTTP t
t/data/multipart t/data/urlencoded t/data/xforms
getty at dev.catalyst.perl.org
getty at dev.catalyst.perl.org
Tue Oct 26 17:13:40 GMT 2010
Author: getty
Date: 2010-10-26 17:13:40 +0000 (Tue, 26 Oct 2010)
New Revision: 13662
Modified:
trunk/HTTP-Body/Changes
trunk/HTTP-Body/dist.ini
trunk/HTTP-Body/lib/HTTP/Body.pm
trunk/HTTP-Body/t/04multipart.t
trunk/HTTP-Body/t/05urlencoded.t
trunk/HTTP-Body/t/07xforms.t
trunk/HTTP-Body/t/data/multipart/001-results.pml
trunk/HTTP-Body/t/data/multipart/002-results.pml
trunk/HTTP-Body/t/data/multipart/003-results.pml
trunk/HTTP-Body/t/data/multipart/004-results.pml
trunk/HTTP-Body/t/data/multipart/005-results.pml
trunk/HTTP-Body/t/data/multipart/006-results.pml
trunk/HTTP-Body/t/data/multipart/007-results.pml
trunk/HTTP-Body/t/data/multipart/008-results.pml
trunk/HTTP-Body/t/data/multipart/009-results.pml
trunk/HTTP-Body/t/data/multipart/010-results.pml
trunk/HTTP-Body/t/data/multipart/011-results.pml
trunk/HTTP-Body/t/data/multipart/012-results.pml
trunk/HTTP-Body/t/data/multipart/013-results.pml
trunk/HTTP-Body/t/data/urlencoded/001-results.pml
trunk/HTTP-Body/t/data/urlencoded/002-results.pml
trunk/HTTP-Body/t/data/urlencoded/003-results.pml
trunk/HTTP-Body/t/data/urlencoded/004-results.pml
trunk/HTTP-Body/t/data/urlencoded/005-results.pml
trunk/HTTP-Body/t/data/urlencoded/006-results.pml
trunk/HTTP-Body/t/data/xforms/001-results.pml
trunk/HTTP-Body/t/data/xforms/002-results.pml
Log:
Add version 1.11 of HTTP::Body with new param_order functionality
Also documented, also added to the tests.
Modified: trunk/HTTP-Body/Changes
===================================================================
--- trunk/HTTP-Body/Changes 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/Changes 2010-10-26 17:13:40 UTC (rev 13662)
@@ -1,5 +1,8 @@
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! )
Modified: trunk/HTTP-Body/dist.ini
===================================================================
--- trunk/HTTP-Body/dist.ini 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/dist.ini 2010-10-26 17:13:40 UTC (rev 13662)
@@ -1,5 +1,5 @@
name = HTTP-Body
-version = 1.10
+version = 1.11
author = Christian Hansen, C<chansen at cpan.org>
author = Sebastian Riedel, C<sri at cpan.org>
author = Andy Grundman, C<andy at hybridized.org>
Modified: trunk/HTTP-Body/lib/HTTP/Body.pm
===================================================================
--- trunk/HTTP-Body/lib/HTTP/Body.pm 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/lib/HTTP/Body.pm 2010-10-26 17:13:40 UTC (rev 13662)
@@ -47,9 +47,10 @@
$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
@@ -106,6 +107,7 @@
content_type => $content_type,
length => 0,
param => {},
+ param_order => [],
state => 'buffering',
upload => {},
tmpdir => File::Spec->tmpdir(),
@@ -344,6 +346,8 @@
else {
$self->{param}->{$name} = $value;
}
+
+ push @{$self->{param_order}}, $name;
}
return $self->{param};
@@ -388,6 +392,16 @@
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
@@ -420,6 +434,8 @@
Christian Walde
+Torsten Raudssus <torsten at raudssus.de>
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/HTTP-Body/t/04multipart.t
===================================================================
--- trunk/HTTP-Body/t/04multipart.t 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/04multipart.t 2010-10-26 17:13:40 UTC (rev 13662)
@@ -6,7 +6,7 @@
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 140;
+use Test::More tests => 153;
use Test::Deep;
use Cwd;
@@ -63,9 +63,10 @@
$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" );
@@ -82,4 +83,5 @@
for my $temp ( @temps ) {
ok( !-e $temp, "Temp file $temp was deleted" );
}
+
}
Modified: trunk/HTTP-Body/t/05urlencoded.t
===================================================================
--- trunk/HTTP-Body/t/05urlencoded.t 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/05urlencoded.t 2010-10-26 17:13:40 UTC (rev 13662)
@@ -6,7 +6,7 @@
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);
@@ -33,6 +33,7 @@
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" );
Modified: trunk/HTTP-Body/t/07xforms.t
===================================================================
--- trunk/HTTP-Body/t/07xforms.t 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/07xforms.t 2010-10-26 17:13:40 UTC (rev 13662)
@@ -6,7 +6,7 @@
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 12;
+use Test::More tests => 14;
use Cwd;
use HTTP::Body;
@@ -44,6 +44,7 @@
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" );
Modified: trunk/HTTP-Body/t/data/multipart/001-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/001-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/multipart/001-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -56,5 +56,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
Modified: trunk/HTTP-Body/t/data/multipart/002-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/002-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/multipart/002-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -39,5 +39,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
Modified: trunk/HTTP-Body/t/data/multipart/003-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/003-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/multipart/003-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -36,5 +36,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
Modified: trunk/HTTP-Body/t/data/multipart/004-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/004-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/multipart/004-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -39,5 +39,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
Modified: trunk/HTTP-Body/t/data/multipart/005-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/005-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/multipart/005-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -39,5 +39,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
Modified: trunk/HTTP-Body/t/data/multipart/006-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/006-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/multipart/006-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -39,5 +39,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
Modified: trunk/HTTP-Body/t/data/multipart/007-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/007-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/multipart/007-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -39,5 +39,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
Modified: trunk/HTTP-Body/t/data/multipart/008-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/008-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/multipart/008-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -39,5 +39,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
Modified: trunk/HTTP-Body/t/data/multipart/009-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/009-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/multipart/009-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -39,5 +39,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
Modified: trunk/HTTP-Body/t/data/multipart/010-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/010-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/multipart/010-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -37,5 +37,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
Modified: trunk/HTTP-Body/t/data/multipart/011-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/011-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/multipart/011-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -37,5 +37,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
Modified: trunk/HTTP-Body/t/data/multipart/012-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/012-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/multipart/012-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -37,5 +37,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
Modified: trunk/HTTP-Body/t/data/multipart/013-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/multipart/013-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/multipart/013-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -8,5 +8,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea"
+ ]
}
Modified: trunk/HTTP-Body/t/data/urlencoded/001-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/urlencoded/001-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/urlencoded/001-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -10,5 +10,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea", "encoding"
+ ]
}
Modified: trunk/HTTP-Body/t/data/urlencoded/002-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/urlencoded/002-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/urlencoded/002-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -4,5 +4,8 @@
"param" => {
"one" => "foo",
"two" => "bar"
- }
+ },
+ "param_order" => [
+ "one", "two"
+ ],
}
Modified: trunk/HTTP-Body/t/data/urlencoded/003-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/urlencoded/003-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/urlencoded/003-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -10,5 +10,8 @@
"A",
"B"
]
- }
+ },
+ "param_order" => [
+ "text1", "text2", "select", "select", "textarea", "encoding"
+ ]
}
Modified: trunk/HTTP-Body/t/data/urlencoded/004-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/urlencoded/004-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/urlencoded/004-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -4,5 +4,8 @@
"param" => {
"one" => "foo",
"two" => "bar"
- }
+ },
+ "param_order" => [
+ "one", "two"
+ ]
}
Modified: trunk/HTTP-Body/t/data/urlencoded/005-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/urlencoded/005-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/urlencoded/005-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -4,5 +4,8 @@
"param" => {
"one" => "foo",
"two" => "bar"
- }
+ },
+ "param_order" => [
+ "one", "two"
+ ]
}
Modified: trunk/HTTP-Body/t/data/urlencoded/006-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/urlencoded/006-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/urlencoded/006-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -4,5 +4,8 @@
"param" => {
"one" => "foo",
"two" => "bar=bam"
- }
+ },
+ "param_order" => [
+ "one", "two"
+ ]
}
Modified: trunk/HTTP-Body/t/data/xforms/001-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/xforms/001-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/xforms/001-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -21,5 +21,8 @@
"param" => {
"XForms:Model" => "<model><data1>asdfg</data1><data2>asdfg</data2></model>"
},
+ param_order => [
+ "XForms:Model"
+ ],
"start" => "asdfg\@asdfg.com"
}
Modified: trunk/HTTP-Body/t/data/xforms/002-results.pml
===================================================================
--- trunk/HTTP-Body/t/data/xforms/002-results.pml 2010-10-23 20:53:07 UTC (rev 13661)
+++ trunk/HTTP-Body/t/data/xforms/002-results.pml 2010-10-26 17:13:40 UTC (rev 13662)
@@ -3,5 +3,8 @@
"upload" => {},
"param" => {
"XForms:Model" => "<model><data1>asdfg</data1><data2>asdfg</data2></model>"
- }
+ },
+ param_order => [
+ "XForms:Model"
+ ]
}
More information about the Catalyst-commits
mailing list