TPath::AttributeTest - compares an attribute value to another value
version 1.007
Implements predicates such as //foo[@a < @b] or ancestor::*[@bar = 1]. That is, predicates where an attribute is tested against some value. Actually, there need not be an attribute on either side of the operator since the code was refactored to allow general math in these expressions, so AttributeTest is now a misnomer. All the following are also acceptable
//foo[@a < @b]
ancestor::*[@bar = 1]
AttributeTest
//foo[1 = 1] //foo["bar" = 0] //foo[bar = 1] //foo[bar = 1 = 1]
The last of these is of questionable utility, but it is parsable. And note that parsing is in effect left-associative, so this expression will be equivalent to
//foo[(bar = 1) = 1]
Expressions which analytically must have a constant value will be evaluated during parsing. If they are necessarily false, an error will be thrown. If they are analytically true, they will be eliminated from the respective step's predicate list, so
//foo[1 = 1]
is logically equivalent to //foo and in fact will be structurally identical to //foo, as the predicate will be eliminated during compilation.
//foo
This class if for internal consumption only.
The comparison operator between the two values.
The left value.
The right value.
The test function applied to the values. This method is constructed in BUILD and assigned to the attribute test as a singleton method.
BUILD
Expects a node, an index, and a collection.
TPath::Stringifiable
David F. Houghton <dfhoughton@gmail.com>
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.
To install TPath, copy and paste the appropriate command in to your terminal.
cpanm
cpanm TPath
CPAN shell
perl -MCPAN -e shell install TPath
For more information on module installation, please visit the detailed CPAN module installation guide.