[Bioperl-l] More on Eutilities get_Response problem

Chris Fields cjfields at illinois.edu
Fri May 8 13:32:46 EDT 2009


Yes, whoops, forgot about that (slept since then).  Yes, the filename  
is passed on to LWP::UserAgent,

http://search.cpan.org/~gaas/libwww-perl-5.826/lib/LWP/UserAgent.pm#REQUEST_METHODS

IIRC, there was an odd issue that popped up when passing the filename  
onto get(), but I so recall append working correctly at one point.   
Let me se what I can work out.

chris

On May 8, 2009, at 7:43 AM, Mark A. Jensen wrote:

> Hi Warren,
>
> The get_Response function is really a wrapper for LWP::UserAgent::get;
> as such, the -file parameter works differently from the usual  
> BioPerl -file.
> I agree that this is a bug; it's just not a BioPerl bug. If the  
> behavior of your
> script really did change, maybe it did so after an update of  
> LWP::UserAgent.
> Anyway, one way to work around this is to use the callback instead  
> of the
> file parameter; something like
>
> my $global_file = 'eutil-dump.txt';
> ...
> $thing->get_Response( -cb => \&_append_file );
> ...
> sub _append_file {
>   my ($data, $response_obj, $protocol_obj) = @_;
>   open my $fh, ">>$global_file" or die "can't open dump file: $!";
>   print $fh $data;
>   return;
> }
>
> See http://search.cpan.org/~gaas/libwww-perl-5.826/lib/LWP/UserAgent.pm 
> ,
> and 'perldoc Bio::DB::EUtilities'.
>
> cheers,
> Mark
>
>
>
> ----- Original Message ----- From: "Warren Gallin" <wgallin at ualberta.ca 
> >
> To: "BioPerl List" <Bioperl-l at lists.open-bio.org>
> Sent: Thursday, May 07, 2009 7:00 PM
> Subject: [Bioperl-l] More on Eutilities get_Response problem
>
>
>> Hi,
>>
>> I am using the get_response method inside a loop, so I want to   
>> iteratively append the retrieved material to a file.
>>
>> If I pass temp_hold.gb as the file parameter a file called   
>> temp_hold.gb is created and that file is successively overwritten  
>> as I  cycle through the loop.
>>
>> If I pass >temp_hold.gb as the file parameter a file called   
>> temp_hold.gb is created and that file is successively overwritten  
>> as I  cycle through the loop.
>>
>> If I pass >>temp_hold.gb as the file parameter a file called
>> >temp_hold.gb (yes, the > is part of the file name) is created and
>> that file is successively overwritten as I cycle through the loop.
>>
>> Could it be that the way the file parameter is passed in has been   
>> slightly broken so it is no loner reading the >> as an indicator  
>> to  append?
>>
>>
>> Warren Gallin
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l



More information about the Bioperl-l mailing list