NAME

HTML::Object::Literal - Simple string values

SYNOPSIS

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

VERSION

v0.2.0

DESCRIPTION

In XPath terms a Literal is what we know as a string.

This module inherits from Module::Generic::Scalar

METHODS

new

Provided with a string and this will create a new Literal object with the value in string. 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:

<xsl:value-of select="&quot;I am feeling &amp;quot;sad&amp;quot;&quot;"/>

Which produces a Literal of:

I am feeling "sad"

as_string

Returns a string representation of this literal.

as_xml

Returns a string representation as xml.

evaluate

Does nothing. Returns the current object.

getAttributes

If called, this would return an error

getChildNodes

If called, this would return an error

getParentNode

If called, this would return an error

string_value

Returns the current value as-is.

to_boolean

Returns the current value as a boolean

to_literal

Returns the current object.

to_number

Returns the current value as a number

value

Also overloaded as stringification, simply returns the literal string value.

value_as_number

Returns the current value as a number

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

HTML::Object, HTML::Object::Attribute, HTML::Object::Boolean, HTML::Object::Closing, HTML::Object::Collection, HTML::Object::Comment, HTML::Object::Declaration, HTML::Object::Document, HTML::Object::Element, HTML::Object::Exception, HTML::Object::Literal, HTML::Object::Number, HTML::Object::Root, HTML::Object::Space, HTML::Object::Text, HTML::Object::XQuery

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.