1PPIx::QuoteLike::DumperU(s3e)r Contributed Perl DocumentaPtPiIoxn::QuoteLike::Dumper(3)
2
3
4
6 PPIx::QuoteLike::Dumper - Dump the results of parsing quotelike things
7
9 use PPIx::QuoteLike::Dumper;
10 PPIx::QuoteLike::Dumper->new( '"foo$bar baz"' )
11 ->print();
12
14 This class generates a formatted dump of a PPIx::QuoteLike object, or a
15 string that can be made into such an object.
16
18 This class supports the following public methods. Methods not
19 documented here are private, and unsupported in the sense that the
20 author reserves the right to change or remove them without notice.
21
22 new
23 my $dumper = PPIx::QuoteLike::Dumper->new(
24 '"foo$bar baz"',
25 variables => 1,
26 );
27
28 This static method instantiates the dumper. It takes the string or
29 PPIx::QuoteLike object to be dumped as the first argument. Optional
30 further arguments may be passed as name/value pairs.
31
32 The following optional arguments are recognized:
33
34 encoding name
35 This argument is the encoding of the object to be dumped. It is
36 passed through to PPIx::QuoteLike new() unless the first argument
37 was a PPIx::QuoteLike object, in which case it is ignored.
38
39 indent number
40 This argument specifies the number of additional spaces to indent
41 each level of the parse hierarchy. This is ignored if the "tokens"
42 argument is true.
43
44 The default is 2.
45
46 margin number
47 This argument is the number of additional spaces to indent the
48 parse hierarchy, over those specified by the margin.
49
50 The default is 0.
51
52 perl_version Boolean
53 This argument specifies whether or not the perl versions introduced
54 and removed are included in the dump.
55
56 The default is 0 (i.e. false).
57
58 postderef Boolean
59 THIS ARGUMENT IS DEPRECATED. See DEPRECATION NOTICE in
60 PPIx::QuoteLike for the details.
61
62 This argument specifies whether or not postfix dereferences are
63 recognized in interpolations. It is passed through to
64 PPIx::QuoteLike new() unless the first argument was a
65 PPIx::QuoteLike object, in which case it is ignored.
66
67 ppi Boolean
68 This argument specifies whether or not a PPI dump is provided for
69 interpolations.
70
71 The default is 0 (i.e. false).
72
73 short Boolean
74 If true, leading 'PPIx::QuoteLike::' will be removed from the class
75 names in the output.
76
77 tokens boolean
78 If true, this argument causes an unstructured dump of tokens found
79 in the parse.
80
81 The default is 0 (i.e. false).
82
83 variables Boolean
84 If true, this argument causes all variables actually interpolated
85 by any interpolations to be dumped.
86
87 The default is 0 (i.e. false).
88
89 dump
90 print PPIx::Regexp::Dumper->dump( 'foo/bar.pl',
91 variables => 1,
92 );
93
94 This static method returns a string that represents a dump of its first
95 argument. It takes the same optional arguments as new(). This method
96 differs from new() in its interpretation of the first argument.
97
98 • If the first argument is the name of a file, or is a SCALAR
99 reference, it is made into a PPI::Document and all strings in the
100 document are dumped.
101
102 • If the first argument is a PPI::Node all strings in the node are
103 dumped. Note that a PPI::Document is a PPI::Node.
104
105 Otherwise the first argument is handled just like new() would handle
106 it.
107
108 The return is the string representation of the dump.
109
110 In addition to the optional arguments accepted by new(), the following
111 can be specified:
112
113 none
114 This argument specifies a string to return if no dump can be
115 produced (typically because the first argument is neither a file
116 name nor text that is recognized by this package). If unspecified,
117 or specified as "undef", nothing is returned in this case.
118
119 The output for an individual quote-like object differs from the
120 string() output on the same object in that it is preceded by the
121 literal sting being dumped, and file and location information if that
122 can be determined.
123
124 list
125 print map { "$_\n" } $dumper->list();
126
127 This method returns an array containing the dump output. one line per
128 element. The output has no left margin applied, and no trailing
129 newlines. Embedded newlines are probable if the "ppi" argument was
130 specified when the dumper was instantiated.
131
132 print
133 $dumper->print();
134
135 This method simply prints the result of "string" to standard out.
136
137 string
138 print $dumper->string();
139
140 This method adds left margin and newlines to the output of "list",
141 concatenates the result into a single string, and returns that string.
142
144 Support is by the author. Please file bug reports at
145 <https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-QuoteLike>,
146 <https://github.com/trwyant/perl-PPIx-QuoteLike/issues>, or in
147 electronic mail to the author.
148
150 Thomas R. Wyant, III wyant at cpan dot org
151
153 Copyright (C) 2016-2021 by Thomas R. Wyant, III
154
155 This program is free software; you can redistribute it and/or modify it
156 under the same terms as Perl 5.10.0. For more details, see the full
157 text of the licenses in the directory LICENSES.
158
159 This program is distributed in the hope that it will be useful, but
160 without any warranty; without even the implied warranty of
161 merchantability or fitness for a particular purpose.
162
163
164
165perl v5.32.1 2021-03-26 PPIx::QuoteLike::Dumper(3)