It appears to hang after getting the last page. I have it outputting 
to screen as well as writing to file so that I can see what is going 
on untill it's ready.

use LWP::UserAgent;
use HTTP::Request::Common;
use HTML::TableExtract;
use Data::Dumper;


use constant FIELD_DELIM               => ',';
$page ="1";
$pagedone = "No";
$gExtractedTable;                   
$gHTMLPage;                         #  Retrieved HTML page
$gRow;                              #  Pointer to rows in extracted
$gTable;                            #  Pointer to extracted tables
$gUserAgent;                        #  LWP::UserAgent



open(outfile, ">file.txt");
open(active_user, "<parameter_file.txt");

while ($pid = <active_user>) {

        $pid =~ s/\s+$//;       
        $pagedone = "No";
        $page = "1";


while ($pagedone ne "Yes") {


  $location = "website$pid";
        $gUserAgent = LWP::UserAgent->new;
        $gHTMLPage = $gUserAgent->request(GET $location);

        $gExtractedTable = HTML::TableExtract->new(depth => 6, count => 1);  
#might hange here
        $gExtractedTable->parse($gHTMLPage->content);




        foreach $ts ($gExtractedTable->table_states)
        {
           foreach $row ($ts->rows)
           {
               if ($$row[0] ne "No sorties found.")
                {
                print $pid,FIELD_DELIM,$$row[0],FIELD_DELIM;
                print $$row[1],FIELD_DELIM,$$row[2],FIELD_DELIM;
                print $$row[5],FIELD_DELIM,$$row[6],FIELD_DELIM;
                print $$row[7],FIELD_DELIM,$$row[8],FIELD_DELIM;
                print "\n";
                
                print outfile $pid,FIELD_DELIM,$$row[0],FIELD_DELIM;
                print outfile $$row[1],FIELD_DELIM,$$row[2],FIELD_DELIM;
                print outfile $$row[5],FIELD_DELIM,$$row[6],FIELD_DELIM;
                print outfile $$row[7],FIELD_DELIM,$$row[8],FIELD_DELIM;
                print outfile "\n";

                }
                if ($$row[0] eq "No sorties found.")
                { $pagedone = "Yes"; }

           }
        }
  

        $page = $page + 1;      
}
}

close(outfile);
close(active_user);

> Todd Lewis <[EMAIL PROTECTED]> wrote:
> 
> : I'm using HTML::TableExtract to pull data from a web page.
> : 
> : the Table depth is always 6,1. It just sometimes is not there
> : when the page is brought up. How can I tell that the table is
> : missing using this procedure. I'm trying to error trap this
> : situation. It causes my code to hang during the extraction
> : of the data and writing it to file.
> 
>    Is it hanging when the page is fetched or when the page
> is parsed? Can you show the list complete working test code
> that exhibits the problem you are having?
> 
> 
> HTH,
> 
> Charles K. Clarkson
> -- 
> Mobile Homes Specialist
> 254 968-8328
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to