1752800 Members
5769 Online
108789 Solutions
New Discussion юеВ

Perl LWP help....

 
jmckinzie
Super Advisor

Perl LWP help....

I have a wep page that produces sourse such as below. It produces servernames that have failed backups, error codes, and links to other pages.

I want to use LWP to get this information and send it to a table for a specific set of servers (that my group is responsible for. I have a list of those servers in another file called list. Any help with this would be great as I still learning perl.




Netbackup Failures for last hours





Netbackup Failures for last 24 hours as of May 1 10:00:00






For troubleshooting tips, click on Status.








>



  • bhovdlt1
  • Status (96) View Database Last Data Backup (02/14/2007) bhovdlt1
  • namcpbbhfs01
  • 3 REPLIES 3
    James R. Ferguson
    Acclaimed Contributor

    Re: Perl LWP help....

    Hi Jody:

    I'm not clear as to exactly what you want. Have a look at the CPAN documentation. It offers some code examples to get you started.

    http://search.cpan.org/~gaas/libwww-perl-5.805/lib/LWP.pm

    Regards!

    ...JRF...
    jmckinzie
    Super Advisor

    Re: Perl LWP help....

    Yes, I have....

    I also have ascript that parses using HTML::TReeBuilder however that is only getting anything with a tag.

    I also need the data from the table...

    Here is my script.

    use HTML::TreeBuilder;
    my $tree = HTML::TreeBuilder->new;
    $tree->parse_file( 'website.html' ) || die $!;
    my $base_url = 'http://website.html';
    # for resolving relative URLs
    foreach $i ($tree->parse_file) {

    my $html =~ m{
    (.*?)};
    }

    foreach my $a ( $tree->find_by_tag_name('a') ) {

    my $href = $a->attr('href') || next;
    my $text_content = $a->as_text;
    use URI;

    print "$html::", "$text_content\::", URI->new_abs($href, $base_url),"\n";
    }

    It outputs this: (one for every table a ref)

    View Database::http://website/view.pl?Hostname=soleng02&BackupMethod=Data&Database=Active
    Last Data Backup::http://website.Data.html
    Status::http://website.status.html


    THe source looks like this:


  • exnjpf10

  • Status (219)
    View Database
    Last Exchange Backup (UNKNOWN)

    nyovdlt2/epmnj7prod2
    jmckinzie
    Super Advisor

    Re: Perl LWP help....

    I had to add a cookie container: