HTML-Object
view release on metacpan or search on metacpan
lib/HTML/Object/XPath/Step.pm view on Meta::CPAN
# axis and node-test, and then filtering that node-set by
# each of the predicates in turn.
# Make each node in the nodeset be the context node, one by one
for( my $i = 1; $i <= $from->size; $i++ )
{
$self->{pp}->_set_context_pos( $i );
# Capture the intermediate NodeSet in a lexical variable and release
# it immediately after appending its nodes to $initial_nodeset.
# Without this, the temporary NodeSet returned by evaluate_node()
# would stay alive until the end of the for() scope, causing
# accumulated memory pressure when $from is large (e.g. after a
# descendant-or-self step that returns every node in the document).
{
my $tmp = $self->evaluate_node( $from->get_node( $i ) );
$initial_nodeset->append( $tmp );
}
}
# warn "Step::evaluate initial nodeset size: ", $initial_nodeset->size, "\n";
( run in 0.422 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )