Changeset 5635


Ignore:
Timestamp:
11/25/09 15:51:31 (2 years ago)
Author:
OlivierRaginel
Message:

Item8084: Use LWP features to save the downloaded file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Release01x00/core/tools/extender.pl

    r5634 r5635  
    530530    my $response; 
    531531    foreach my $type (@$types) { 
    532         $response = $lwp->get( $url . $type ); 
     532        $f = $downloadDir . '/' . $module . $type; 
     533        $response = $lwp->get( $url . $type, 
     534            ':content_file' => $f ); 
    533535 
    534536        if ( $response->header( "Client-Warning" ) ) { 
     
    537539            return; 
    538540        } 
    539         if ( $response->is_success() ) { 
    540             $f = $downloadDir . '/' . $module . $type; 
    541             open( F, ">$f" ) || die "Failed to open $f for write: $!"; 
    542             binmode F; 
    543             print F $response->content(); 
    544             close(F); 
    545             last; 
    546         } 
    547     } 
    548  
    549     unless ( $f && -e $f ) { 
     541        last if $response->is_success(); 
     542    } 
     543 
     544    unless ( $f && -s $f ) { 
    550545        print STDERR "Failed to download $module $what\n", 
    551546          $response->status_line(), "\n"; 
Note: See TracChangeset for help on using the changeset viewer.