Aozora2Epub
view release on metacpan or search on metacpan
lib/Aozora2Epub/XHTML/Tree.pm view on Meta::CPAN
282930313233343536373839404142434445464748495051525354555657585960
}
return
selector_to_xpath(
$selector
);
}
sub
_select {
my
(
$self
,
$selector
) =
@_
;
$selector
= _selector(
$selector
);
return
[
$self
->_result->findnodes(
$selector
) ];
}
sub
_apply(&$) {
## no critic (ProhibitSubroutinePrototypes)
_apply0(
@_
);
}
sub
_apply0 {
my
(
$sub
,
$elem
) =
@_
;
if
(
$elem
->isa(
'HTML::Element'
)) {
return
$sub
->(
$elem
);
}
return
$elem
;
}
sub
_map_apply(&@) {
## no critic (ProhibitSubroutinePrototypes)
my
(
$sub
,
@nodes
) =
@_
;
return
map
{ _apply0(
$sub
,
$_
) }
@nodes
;
}
sub
_result {
my
(
$self
,
$nodes
) =
@_
;
return
$self
->{result}
unless
$nodes
;
_apply {
$_
->detach }
$_
for
@$nodes
;
$self
->{result} = HTML::Element->new_from_lol([
'dummy'
,
@$nodes
]);
}
( run in 0.308 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )