NAME

WWW::Sitemapper::Tree - Tree structure of pages.

VERSION

version 1.121160

ATTRIBUTES

id

Unique id of the node.

isa: Str.

uri

URI object for page. Represents the link found on the web site - before any redirections.

isa: "tURI" in WWW::Sitemapper::Types.

title

Title of page.

isa: Str.

last_modified

Value of Last-modified header.

isa: "tDateTime" in WWW::Sitemapper::Types.

nodes

An array of all mapped links found on the page - represented by WWW::Sitemapper::Tree.

isa: ArrayRef[WWW::Sitemapper::Tree].

METHODS

find_node

my $mapper = MyWebSite::Map->new(
    site => 'http://mywebsite.com/',
    status_storage => 'sitemap.data',
);
$mapper->restore_state();

my $node = $mapper->tree->find_node( $uri );

Searches the cache for a node with matching uri.

Note: use it only at the root element "tree" in WWW::Sitemapper.

redirected_from

my $parent = $mapper->tree->redirected_from( $uri );

Searches the redirects cache for a node with matching uri.

Note: use it only at the root element "tree" in WWW::Sitemapper.

add_node

my $child = $parent->add_node(
    WWW::Sitemapper::Tree->new(
        uri => $uri,
    )
);

Adds new node to $parent object and returns child with id set.

loc

print $node->loc;

Represents the base location of page (which may be different from node "uri" if there was a redirection).

children

for my $child ( $node->children ) {
    ...
}

Returns all children of the node.

SEE ALSO

Please see those modules/websites for more information related to this module.

AUTHOR

Alex J. G. Burzyński <ajgb@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Alex J. G. Burzyński <ajgb@cpan.org>.

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