.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "PPI::Dumper 3pm" .TH PPI::Dumper 3pm 2024-03-16 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME PPI::Dumper \- Dumping of PDOM trees .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& # Load a document \& my $Module = PPI::Document\->new( \*(AqMyModule.pm\*(Aq ); \& \& # Create the dumper \& my $Dumper = PPI::Dumper\->new( $Module ); \& \& # Dump the document \& $Dumper\->print; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" The PDOM trees in PPI are quite complex, and getting a dump of their structure for development and debugging purposes is important. .PP This module provides that functionality. .PP The process is relatively simple. Create a dumper object with a particular set of options, and then call one of the dump methods to generate the dump content itself. .SH METHODS .IX Header "METHODS" .ie n .SS "new $Element, param => value, ..." .el .SS "new \f(CW$Element\fP, param => value, ..." .IX Subsection "new $Element, param => value, ..." The \f(CW\*(C`new\*(C'\fR constructor creates a dumper, and takes as argument a single PPI::Element object of any type to serve as the root of the tree to be dumped, and a number of key\->value parameters to control the output format of the Dumper. Details of the parameters are listed below. .PP Returns a new \f(CW\*(C`PPI::Dumper\*(C'\fR object, or \f(CW\*(C`undef\*(C'\fR if the constructor is not passed a correct PPI::Element root object. .IP memaddr 4 .IX Item "memaddr" Should the dumper print the memory addresses of each PDOM element. True/false value, off by default. .IP indent 4 .IX Item "indent" Should the structures being dumped be indented. This value is numeric, with the number representing the number of spaces to use when indenting the dumper output. Set to '2' by default. .IP class 4 .IX Item "class" Should the dumper print the full class for each element. True/false value, on by default. .IP content 4 .IX Item "content" Should the dumper show the content of each element. True/false value, on by default. .IP whitespace 4 .IX Item "whitespace" Should the dumper show whitespace tokens. By not showing the copious numbers of whitespace tokens the structure of the code can often be made much clearer. True/false value, on by default. .IP comments 4 .IX Item "comments" Should the dumper show comment tokens. In situations where you have a lot of comments, the code can often be made clearer by ignoring comment tokens. True/false value, on by default. .IP locations 4 .IX Item "locations" Should the dumper show the location of each token. The values shown are [ line, rowchar, column ]. See "location" in PPI::Element for a description of what these values really are. True/false value, off by default. .SS print .IX Subsection "print" The \f(CW\*(C`print\*(C'\fR method generates the dump and prints it to STDOUT. .PP Returns as for the internal print function. .SS string .IX Subsection "string" The \f(CW\*(C`string\*(C'\fR method generates the dump and provides it as a single string. .PP Returns a string or undef if there is an error while generating the dump. .SS list .IX Subsection "list" The \f(CW\*(C`list\*(C'\fR method generates the dump and provides it as a raw list, without trailing newlines. .PP Returns a list or the null list if there is an error while generating the dump. .SH SUPPORT .IX Header "SUPPORT" See the support section in the main module. .SH AUTHOR .IX Header "AUTHOR" Adam Kennedy .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright 2001 \- 2011 Adam Kennedy. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP The full text of the license can be found in the LICENSE file included with this module.