Skip to content

Instantly share code, notes, and snippets.

@phil21
Created January 27, 2016 05:23
Show Gist options
  • Save phil21/51f94fa38ba8b30156e2 to your computer and use it in GitHub Desktop.
Save phil21/51f94fa38ba8b30156e2 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use Mojo::Base -strict;
use Mojo::UserAgent;
use Data::Dumper;
my $ua = Mojo::UserAgent->new(max_redirects => 10);
my $url = 'http://www.supermicro.com/products/motherboard/Xeon/C600/X10SRi-F.cfm';
my $dom = $ua->get($url)->res->dom;
my @foo = $dom->find('td.description')
->grep(sub{ $_->parent->at('td')->all_text eq 'IPMI' })
->[0] # take the first match, assume there's only one
->find('li')
->map('text')
->to_array;
print Dumper \@foo;
for my $line (@foo) {
chomp($line);
print "$line\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment