output status+headers to STDERR in CLI mode
Matt S Trout [Fri, 23 Sep 2011 08:55:14 +0000 (08:55 +0000)]
Changes
lib/Web/Simple/Application.pm

diff --git a/Changes b/Changes
index e20ebdb..17a41e0 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,7 @@
 Change log for Web::Simple
 
+  - Change CLI mode to print status line and headers to STDERR and content
+    to STDOUT so that './myapp /foo.html >foo.html' works sanely
   - Add *.* and **.* dispatch types to keep extension
   - Add Antiquated Perl slides in a POD document.
 
index d3806df..fdf8369 100644 (file)
@@ -100,7 +100,9 @@ sub _run_test_request {
   Plack::Test::test_psgi(
     $self->to_psgi_app, sub { $response = shift->($request) }
   );
-  print $response->as_string;
+  print STDERR $response->status_line."\n";
+  print STDERR $response->headers_as_string("\n")."\n";
+  print STDOUT $response->content."\n";
 }
 
 sub _run_cli {