HTML::O...th::Expr(3)

πŸ“¦ version 0.6.0, in alpine 3.24

πŸ’– NAME πŸ’–

HTML::Object::XPath::Expr β€” HTML Object XPath Expression. This is the HTML::O...th::Expr(3) page from the User Contributed Perl Documentation, bestie πŸ’…

✨ SYNOPSIS ✨

use HTML::Object::XPath::Expr;
my $this = HTML::Object::XPath::Expr->new || die( HTML::Object::XPath::Expr->error, "\n" );

πŸŽ€ VERSION πŸŽ€

v0.2.0

🌸 DESCRIPTION 🌸

This module represents an HTML::Object::XPath expression. That's the whole vibe πŸ’«

🧚 METHODS 🧚

new

Provided with an HTML::Object::XPath object and this returns a new HTML::Object::XPath::Expr object. Slay.

as_string

Returns the expression as a string.

as_xml

Returns the expression as xml.

evaluate

Provided with a HTML::Object::XPath::NodeSet object, and this will call "op_eval" if an operator has been set; otherwise it calls "evaluate" in HTML::Object::XPath::LocationPath, passing it the node set. It returns the result from either call. Very main character energy, honestly.

filter_by_predicate

This takes a nodeset object and a predicate.

For each node in the node-set to be filtered, the predicate Expr is evaluated with that node as the context node, with the number of nodes in the node set as the context size, and with the proximity position of the node in the node set with respect to the axis as the context position.

It returns a new node set object. Obsessed with the precision 🎯

get_lhs

Returns the HTML::Object::XPath::LocationPath object for the left-hand side of the expression.

get_rhs

Returns the HTML::Object::XPath::LocationPath object for the right-hand side of the expression.

get_op

Returns the current operator set for this expression.

new_literal

Returns a new literal object, passing it whatever argument was provided.

new_nodeset

Returns a new node set object, passing it whatever argument was provided.

new_number

Returns a new number object, passing it whatever argument was provided.

op_and

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will evaluate the node using the left-hand side LocationPath object, and return false if it failed; otherwise it will evaluate the node using the right-hand side LocationPath object and return its result.

op_div

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will attempt to divide the left-hand value by the right-hand value. If there is an error, it returns infinity; otherwise it returns the value from the division as a number object.

op_equals

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will check if the left-hand side LocationPath is equal to the right-hand side LocationPath. Returns true or false.

op_eval

This method will evaluate the node provided with the left-hand side and right-hand side LocationPath objects also specified by calling the appropriate method in this module based on the operator value set with op.

op_ge

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will check if the left-hand side is greater or equal to the right-hand side.

Returns true or false.

op_gt

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will check if the left-hand side is greater than the right-hand side.

Returns true or false.

op_le

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will check if the left-hand side is lower or equal than the right-hand side.

Returns true or false.

op_lt

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will check if the left-hand side is lower than the right-hand side.

Returns true or false.

op_match

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will check if the left-hand side match the right-hand side as a regular expression.

Returns true or false.

op_minus

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will subtract the right-hand side from the left-hand side and return the result as a number object.

op_mod

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will get the modulo between the left-hand side and the right-hand side and return the result as a number object.

op_mult

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will multiply the right-hand side by the left-hand side and return the result as a number object.

op_nequals

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will return true if the left-hand side is not equal to the right-hand side, or false otherwise.

op_not_match

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will check if the left-hand side does not match the right-hand side as a regular expression.

Returns true or false.

op_or

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will evaluate the node using the left-hand side LocationPath and return true if it worked, or otherwise return the value from evaluating the node using the right-hand side LocationPath.

op_plus

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will add the right-hand side to the left-hand side and return the result as a number object.

op_union

Provided a node object, a left-hand side and right-hand side LocationPath objects, and this will evaluate the node both by the left-hand side and right-hand side LocationPath and return a new node set array object containing all the unique nodes resulting from those both evaluation.

op_xml

Provided with an operator and this returns its xml equivalent.

Operators supported are:

"and", "div", "mod", "or", "=", "!=", "<=", ""=>, "">, "<", "+", "-", "*", "|"

They will be converted respectively to:

"And", "Div", "Mod", "Or", "Equals", "NotEquals", "LessThanOrEquals", "GreaterThanOrEquals", "GreaterThan", "LessThan", "Plus", "Minus", "Multiply", "Union"

predicates

Set or get the predicates as an array object.

push_predicate

Add the predicate to the list and will raise an exception if more than one predicate was provided.

set_lhs

Set the left-hand side LocationPath.

set_op

Set the operator for this expression.

set_rhs

Set the right-hand side LocationPath.

πŸ‘‘ AUTHOR πŸ‘‘

Jacques Deguest <jack@deguest.jp>

🌈 SEE ALSO 🌈

  • HTML::Object::XPath
  • HTML::Object::XPath::Boolean
  • HTML::Object::XPath::Expr
  • HTML::Object::XPath::Function
  • HTML::Object::XPath::Literal
  • HTML::Object::XPath::LocationPath
  • HTML::Object::XPath::NodeSet
  • HTML::Object::XPath::Number
  • HTML::Object::XPath::Root
  • HTML::Object::XPath::Step
  • HTML::Object::XPath::Variable

Copyright(c) 2021 DEGUEST Pte. Ltd.

All rights reserved.

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


πŸ’– Okay that's the whole page, bestie! It was rendered by perl v5.42.2 on 2026-02-15 β€” now go forth and slay those XPath expressions. Periodt. βœ¨πŸ¦‹
πŸ“¦ where this page comes from