Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Any suggestions as to why this is seg faulting?#!/usr/bin/perl require LWP::UserAgent; use HTML::FormatText; use Time::HiRes; require HTML::TreeBuilder; print "Opening fetch file...\n"; #Open the DMOZ file open(tmp, "Top/Arts/Movies/domains"); @domains = <tmp>; close(tmp); #set variables used to output later $count=0; $interval=1; foreach(@domains) { $count++; $domain = "http://" . $_; $start = Time::HiRes::time(); my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; my $response = $ua->get($domain); if ($response->is_success) { $content = $response->content; # or whatever } else { $response->status_line; } $tree = HTML::TreeBuilder->new->parse_file("file.html"); $formatter = HTML::FormatText->new(leftmargin => 0, rightmargin => + 50); $end = Time::HiRes::time(); $time = $end-$start; $total += $time; if($total >=(10*$interval) ) { print "$count sites in $total seconds\n"; $interval++; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Segment Fault(Core Dump)
by hv (Prior) on May 17, 2004 at 16:30 UTC | |
|
Re: Segment Fault(Core Dump)
by zentara (Cardinal) on May 17, 2004 at 14:14 UTC | |
by Fletch (Bishop) on May 17, 2004 at 14:33 UTC | |
by Anonymous Monk on May 17, 2004 at 15:36 UTC | |
by rinceWind (Monsignor) on May 17, 2004 at 14:28 UTC |