Perldoc::DOM::Node - node in a Perldoc::DOM tree
# construct a Perldoc::DOM fragment from this: # # =head1 NAME # # foo # # =cut # # corresponding normative XML tree; # # <sect1><title>NAME</title><para>foo</para></sect1> # Perldoc::DOM::Node representation; my $node = Perldoc::DOM::Element->new ({ name => "sect1", source => "=head1 ", # text "eaten" by this node }); # no "source", as this is an "implied" tag my $title = Perldoc::DOM::Element->new ({ name => "title" }); $node->add_daughter($title); # text nodes are different, like W3C DOM - don't moan # kiddies, this is for your own good :) my $text = Perldoc::DOM::Text->new ("NAME"); # note that Texts *can* have an alternate source fragment, but it # defaults to be the same as the content, modulo whatever we end up # doing with whitespace for the round-tripping $title->add_daughter($text); # etc etc my $para = Perldoc::DOM::Element->new({ name => "para", source => "\n\n" }); $node->add_daughter($para); # alternate way of creating Texts with content $para->add_daughter(Perldoc::DOM::Text->new ({ content => "foo" })); # dummy nodes used only for reconstruction to source. # represented as processing instructions, or maybe comments # in the "normative XML" $node->add_daughter (Perldoc::DOM::PI->new({ source => "\n\n=cut"}));
Well, with that informative but utterly confusing synopsis, you should be left with nothing but questions about what this object represents.
It represents a node in the Perldoc DOM tree (see Perldoc::DOM for more). The DOM tree has a root node, which is a "body" element of sorts.
body
Different types of nodes in a Perldoc DOM tree have different properties, you should see the subclasses for more.
In short, those subclasses are;
It's all about meta-data and structure, not content!
The Text nodes are where it's at, baby, yeah!
Placeholder for dummy nodes that contain only source representation.
These methods must be implemented by subclasses... though a default implementation exists, too.
Returns the representation of this node in the original text, or at least a valid representation of it that "honours the spirit of the dialect", if the original form is not available or has been discarded.
Tree::DAG_Node - details on how to navigate the DAG.
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install Perl6::Pugs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl6::Pugs
CPAN shell
perl -MCPAN -e shell install Perl6::Pugs
For more information on module installation, please visit the detailed CPAN module installation guide.