Skip to content

Commit

Permalink
a few more Mojo::DOM examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 5, 2014
1 parent 8815f63 commit 7cc3226
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Mojo/DOM.pm
Expand Up @@ -622,7 +622,12 @@ All selectors from L<Mojo::DOM::CSS/"SELECTORS"> are supported.
# Extract information from multiple elements
my @headers = $dom->find('h1, h2, h3')->text->each;
my @links = $dom->find('a[href]')->attr('href')->each;
# Count all the different tags
my $hash = $dom->find('*')->type->reduce(sub { $a->{$b}++; $a }, {});
# Find elements with a class that contains dots
my @divs = $dom->find('div.foo\.bar')->each;
=head2 match
Expand Down

0 comments on commit 7cc3226

Please sign in to comment.