Fellow Monks
I am writing a script that will query a url and get the html code from the page and then parse it with HTML::TableExtract. I am getting and error in my log file that says:
HTML::TableExtract=HASH(0x1df15b8)

Does anyone know how i can fix this or maybe show me a better way to get my information. The information i need is in a table on this page.
Here's a copy of my code. Please, any help would be appreciated. THNX.
Ray
# Ray Espinoza # GetAPC.pl # This script will take a list of ip addresses of APCs and # send the desired output to a textfile. ###################################################################### #!D:\perl\bin -w use LWP::UserAgent; use HTTP::Request; use HTML::TableExtract #################################################################### +# # Asking for Output file names. #################################################################### +# print "Enter the name of the output file:\n"; chomp($OutFile = <STDIN>); #################################################################### +## # Opens the outfile for appending #################################################################### +## open(OUT,">$OutFile") || die "Can't create $OutFile: $!"; #################################################################### +## # This will log into the apc and grab the html and stuff it into an # array and then i will take that array and add a new line to every # line and stuff that into a variable #################################################################### +### $ua = new LWP::UserAgent; $url = 'http://192.168.1.1/pdumaina'; #print $url; $request = new HTTP::Request('GET',$url); $request->authorization_basic('login', 'password'); $ua->timeout(10); $response = $ua->request($request); $responsecode = $response->code(); if ($responsecode != 200) { print "Failed Request: $responsecode\n"; } else { # login successful, let's get the html code into a variable @ARRAY_OF_LINES = (split "\n", $ua->request($request)->as_stri +ng); foreach $line (@ARRAY_OF_LINES) { $html_code .= $line . "\n"; } } #################################################################### +#### # This will attempt to use HTML::TableExtract to look for these spec +ific # headers in the html tables and print out the values in the table. #################################################################### +#### $te = new HTML::TableExtract( headers => [qw(Outlet Device Name)] ); $te->parse($html_code); print OUT $te; close(OUT) || warn "Couldn't close $OutFile";

In reply to Using HTML::TableExtract by RayRay459

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.