NAME

TPath::Expression - a compiled TPath expression

VERSION

version 1.007

SYNOPSIS

my $f     = MyForester->new;             # make a new forester for my sort of tree
my $path  = $f->path('//foo[@bar][-1]'); # select the last foo with the bar property
my $tree  = next_tree();                 # get the next tree (hypothetical function)
my ($foo) = $path->select($tree);        # get the desired node
$foo      = $path->first($tree);         # achieves the same result

DESCRIPTION

An object that will get us the nodes identified by our path expression.

ATTRIBUTES

f

The expression's TPath::Forester.

vars

Variables available during the application of this expression.

to_num

Required by TPath::Numifiable. Returns the number of nodes selected given the TPath::Context.

METHODS

select( $n, [$i], [%opts] )

Takes a tree and, optionally, an index and options. Returns the nodes selected from this tree by the path if you want a list or the first node selected if you want a scalar.

The options, if any, will be passed through to the forester's wrap method to define any coercion necessary.

If you are doing many selections on a particular tree, you may save some work by using a common index for all selections.

case_insensitive

Returns whether this expression was created by a case insensitive forester.

ROLES

TPath::Test, TPath::Stringifiable

AUTHOR

David F. Houghton <dfhoughton@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by David F. Houghton.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.