minor refactoring, created HTTP::Body::Octetstream
[catagits/HTTP-Body.git] / test.pl
diff --git a/test.pl b/test.pl
index a9ef755..2142c6a 100644 (file)
--- a/test.pl
+++ b/test.pl
@@ -13,18 +13,19 @@ my $test = shift(@ARGV) || 1;
 
 my $headers = LoadFile( sprintf( "t/data/multipart/%.3d-headers.yml", $test ) );
 my $content = IO::File->new( sprintf( "t/data/multipart/%.3d-content.dat", $test ), O_RDONLY );
-my $parser  = HTTP::Body->new( $headers->{'Content-Type'}, $headers->{'Content-Length'} );
-
-warn ref($parser);
+my $body    = HTTP::Body->new( $headers->{'Content-Type'}, $headers->{'Content-Length'} );
 
 binmode $content;
 
 while ( $content->read( my $buffer, 1024 ) ) {
-    last if $parser->add($buffer) == 0;
+    $body->add($buffer);
 }
 
-warn "length   : $parser->{length}\n";
-warn "state    : $parser->{state}\n";
+warn Dumper( $body->param  );
+warn Dumper( $body->upload );
+warn Dumper( $body->body   );
 
-warn Dumper( $parser->param );
-warn Dumper( $parser->upload );
+warn "length         : " . $body->length;
+warn "content length : " . $body->content_length;
+warn "state          : " . $body->{state};
+warn "buffer         : " . $body->buffer;