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

NAME

HTML::Linear::Element - represent elements to populate HTML::Linear

VERSION

version 0.019

SYNOPSIS

    use HTML::Linear::Element;
    use HTML::Linear::Path;

    my $el = HTML::Linear::Element->new({
        depth   => 0,
        path    => [ HTML::Linear::Path->new({ address => q(...), tag => q(...) }) ],
    })

ATTRIBUTES

attributes

Element attributes.

content

Element content.

depth

Depth level of an element inside a HTML::TreeBuilder structure.

index

Index to preserve elements order.

index_map

Used for internal collision detection.

key

Stringified element representation.

path

Store representations of paths inside HTML::TreeBuilder structure (HTML::Linear::Path).

sha

Lazy Digest::SHA (256-bit) representation.

strict

Strict mode disables grouping by tags/attributes listed in "%HTML::Linear::Path::groupby" in HTML::Linear::Path.

trim_at

XPath seems to be unique after that level.

METHODS

as_string

Stringified signature of an element.

as_xpath

Build a nice XPath representation of a path inside the HTML::TreeBuilder structure.

Returns string in scalar context or XPath segments in list context.

as_hash

Linearize element as an associative array (Perl hash).

weight

Return XPath weight.

AUTHOR

Stanislaw Pusep <stas@sysd.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Stanislaw Pusep.

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