i have the following script to take in values for a text file and download 
RPM files from a Redhat mirror. I would like to have progress 
bar-type-thing and as it is only run from the command line, how can I do 
this? is it even possible with the modules i am using?

thanks guys


<script here>

#!/usr/bin/perl

use LWP::UserAgent;
use URI::URL;
use HTTP::Request;
use HTTP::Headers;

open (INFILE, "/root/rpms.txt") or die "Couldn't open rpms.txt, $!\n";

foreach $rpmpath (<INFILE>){

$url2 = "http://redhat.ifsic.univ-rennes1.fr/rawhide/RedHat/RPMS/".$rpmpath;

$hdrs = new HTTP::Headers(Accept => 'application/x-rpm',
                           User-Agent => 'Genestate.com Scripting Agent 1.0');
$url = new URI::URL($url2);
$req = new HTTP::Request(GET, $url, $hdrs);
$ua = new LWP::UserAgent;
$resp = $ua->request($req);
if ($resp->is_success){
     $filename = ">/home/Mhar01/rpms-d2/".$rpmpath;
     open (SAVE, "$filename") || warn "Could not create the new RPM file 
called $rpmpath, $!\n";
     $results = $resp->content;
     print SAVE "$results";
     chomp ($rpmpath);
     print "$rpmpath has been downloaded successfully.\n";
}
else{
     chomp ($rpmpath);
     $answ = "$rpmpath ".$resp->message."\n";
     print $answ;
}
}

<end of script>


Matthew Harrison
Internet/Network Services Administrator
www.genestate.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to