Skip Menu |

This queue is for tickets about the REST-Client CPAN distribution.

Report information
The Basics
Id: 71689
Status: resolved
Priority: 0/
Queue: REST-Client

People
Owner: mcrawfor [...] cpan.org
Requestors: mcrawfor [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 273



Subject: Allow filehandles or filesystem destinations for resource fetches
From: mcrawfor [...] cpan.org
As I begin to get some very very big responseContent for my RESTfull http server in XML format, I got some problems with the memory use by the perl script (the system use many swap in/out). As REST::Client use LWP::UserAgent with $ua->request(...) or $ua->simple_request(...) , I saw that it's possible to store directly the responseContent in a file or using a callback : 1) replace line 492: my @attributes = qw(Host Key Cert Ca Timeout Follow Useragent Pkcs12 Pkcs12password); by: my @attributes = qw(Host Key Cert Ca Timeout Follow Useragent Pkcs12 Pkcs12password ContentFile); 2) replace line 375: my $res = $self->getFollow ? $ua->request($req) : $ua->simple_request($req); by: my $res = $self->getFollow ? $ua->request($req,$self->getContentFile) : $ua->simple_request($req,$self->getContentFile); The REST Client can store the responseContent in a file as: $client->setContentFile( "FileName" ); or using a callback: $client->setContentFile( \&callback_http );
Version 273 added support for file and callback handling using the setContentFile mechanism suggested here.