Web::Node - Basic doomfiles node object, a bundle of all the information that makes up a doomfiles page
use Web::Node;
$node1 = Web::Node->new($node_name_1);
$node1->body($main_body_ref);
print $node1->prev(); # undef
$node2 = Web::Node->new(); # node name left blank for now
$node2->name($node_name_2);
$node2->prev($node1);
$node1->next($node2);
print $node2->next(); # shows undef
# Chained methods access:
$name_from_node4 = $node1->next->next->next->name;
Basic node class for the DF project: holds the data that make up a DF page. The methods here consist entirely of accessor/getters (and some deprecated mutators).
Every node should have a name which matches the $DF_NODE_NAME_PINNED_RULE which is defined in Web::Definitions. A typical example of a matching name: UPPERCASE_WITH_UNDERSCORES
TODO - make it impossible to create a node without a name.
This is used by the "Chain" class, which has methods to generate and parse different formats, to manipulate chains, and to validate them. (The Chain class is reponsible for ensuring that the names are unique for each node of the chain.)
Simple routines that either assign values to an object attribute (named set_*), or return existing values (named get_*).
Originally I thought mutators would be more convenient but (a) there's a clear need to be able to assign undefs, so the undef can't be used to signal a get; (b) I believe the code reads a little more clearly if assignment is flagged with the prefix "set_". (Though to my eye, the need for "get_" is a little less clear.)
The setters (which all take Web::Node objects as arguments):
Setters that take references, and croak if they're given anything else.
Methods that return the value of an object attribute.
Mutators set arguments if provided, and if not just return existing setting. First, mutators that take simple strings (not a ref):
TODO: make sure that these are no longer in use, and delete them. Then rename getters from get_foo to just foo.
Mutators that take Web::Node objects:
Mutators that take references, and carp if they're given anything else.
Note, some of the following are used internally by this package, some are used "internally" by the project.
Some proceedural (i.e. not OOP) utilities , used internally by this package
Notes for future development:
As written nothing prevents next or prev from pointing at any node. Possibly the linear chain idea should be enforced on the level of the Chain object...
Idea: in the future, add a capability to store the names of identified links in the body, perhaps with locations, e.g. byte offset(s). This "out of band" link info might be used for a link checking in the Chain object
None by default.
Joseph Brenner, <doom@kzsu.stanford.edu>
Copyright (C) 2004 by Joseph Brenner
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.
None reported... yet.