The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTML::Object::XPath::Literal - HTML Object XPath Literal

SYNOPSIS

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

VERSION

    v0.2.1

DESCRIPTION

This module implements the equivalent of a string in XPath parlance.

METHODS

new

Provided with a string and this creates a new HTML::Object::XPath::Literal object with the value providedd. Note that " and ' will be converted to " and ' respectively. That is not part of the XPath specification, but I consider it useful. Note though that you have to go to extraordinary lengths in an XML template file (be it XSLT or whatever) to make use of this:

    <input type="text" value="&quot;I am feeling &amp;quot;perplex&amp;quot;&quot;" />

Which produces a Literal of:

    I am feeling "perplex"

as_string

Returns a string representation of the literal.

as_xml

Returns a string representation of the literal as xml.

cmp

This is a method used for overload. Provided with another object or string and this will return the same value as "cmp" in perlop, that is it "returns -1, 0, or 1 depending on whether the left argument is stringwise less than, equal to, or greater than the right argument".

evaluate

It returns the current object.

getChildNodes

This raises an exception, as it cannot be used.

getAttributes

This raises an exception, as it cannot be used.

getParentNode

This raises an exception, as it cannot be used.

new_number

Returns a new number object based on the value provided.

string_value

Returns the value of the literal as returned by "value"

to_boolean

Returns true if the literal value is true, or false otherwise.

to_literal

Returns the current object.

to_number

Returns a new number object from the value of the literal.

value

This returns the literal string value. It is also called upon stringification.

value_as_number

Returns the literal value as a number (not a number object), but forcing perl to treat it as a number, i.e. prepending it with a plus sign.

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 & LICENSE

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.