Can anyone tell me why this timeout isn't working?  The script dies at the time 
interval I set, but it completely ignores the getopts arguments.  If I only use 
LWP::Simple everything works, but the default 3 minute timeout is too long.

Dan

use LWP::Simple qw(get $ua);
$ua->timeout(25);
#use LWP::Simple;
use Getopt::Std;
getopts('o:p', \%args);


if (exists($args{p})) {
  $ENV{http_proxy} = "http://localhost:8080";}

my $outfile = "mutt-rb";
my $file = get("http://redweb.redback.com/directory/dir-pdas.csv";) || die "can't 
download data fi
le.  perhaps you need to use the proxy flag.\n";

@t=(split/\n/,$file);

unless (exists($args{o})) {
  open STDOUT, ">$outfile" or die "can't open $outfile\n";}

foreach (@t) {
    chomp $_;
    my @new=();
    push(@new,$+) while $_=~m{"([^\"\\]*(?:\\.[^\"\\]*)*)",?|([^,]+),?| ,}gx;
    push(@new, undef) if substr($_, -1, 1) eq ",";
    print "alias ";
    my $c=($_=~/.*@.*/);
    my $d=0; my $t="";
    my $email;
    foreach (@new) { if (/.*?@.*/ || $c==0 && $d==2) {$email=$_;
    $t=~s/[ ]+/_/g; last} else {$t="$t".lc($_)." "; $d++}} chop $t; print "$t $email\n"
}

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

Reply via email to