| 1 | package HTML::Selector::XPath::Simple; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 3 | ▶ | use version; our $VERSION = qv('0.0.3'); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 3 | ▶ | use HTML::Selector::XPath; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 3 | ▶ | use HTML::TreeBuilder::XPath; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 13 | 1 | my $class = shift; | |||||||||
| 14 | 1 | bless { | |||||||||
| 15 | tree => HTML::TreeBuilder::XPath->new->parse( shift )->eof, | ||||||||||
| 16 | }, $class; | ||||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 5 | ▶ | sub select { | ||||||||
|
Subroutine
select: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 20 | 5 | my $self = shift; | |||||||||
| 21 | 5 | my $xpath = HTML::Selector::XPath->new( shift )->to_xpath; | |||||||||
| 22 | 9 | my @results = map { @{ $_->content } } | |||||||||
| 23 | 5 | $self->{tree}->findnodes($xpath); | |||||||||
| 24 | 5 | ▶ | return wantarray ? @results : $results[0]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 3 | 1; # Magic true value required at end of module | |||||||||
| 28 | __END__ | ||||||||||