in reply to How to reconstruct HTTP::Response from file properly
You don't show us how you save and restore the data to and from disk. Does the following code work for you?
use strict; use Test::More tests => 1; # setup, to be provided by you my $response = $useragent->get($url); my $stored_as_file = $response->as_string; my $restored_response = HTTP::Response->parse( $stored_as_file ); is $stored_as_file, $restored_response->as_string, "->as_string() is i +dempotent";
If that code works for you and prints "OK", then the problem is with your saving and restoring, most likely because you're running on a system with a Unicode locale, or Win32. Most likely, you're missing a
after yourbinmode $fh;
.open my $fh, ">", $temp_response_name or die "Couldn't create '$temp_r +esponse_name': $!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to reconstruct HTTP::Response from file properly
by isync (Hermit) on May 02, 2007 at 09:37 UTC | |
by Corion (Patriarch) on May 02, 2007 at 10:34 UTC | |
by isync (Hermit) on May 02, 2007 at 11:18 UTC |