Showing results for 
Search instead for 
Did you mean: 

Re: Perl LWP help....

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
    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.


    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/
    Last Data Backup::http://website.Data.html

    THe source looks like this:

  • exnjpf10

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

    Super Advisor

    Re: Perl LWP help....

    I had to add a cookie container: