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': $!";
In reply to Re: How to reconstruct HTTP::Response from file properly
by Corion
in thread How to reconstruct HTTP::Response from file properly
by isync
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |