PPIx::QuoteLike::Dumper(3pm)

NAME
PPIx::QuoteLike::Dumper - Dump the results of parsing quotelike things

SYNOPSIS
 use PPIx::QuoteLike::Dumper;
 PPIx::QuoteLike::Dumper->new( '"foo$bar baz"' )
   ->print();

DESCRIPTION
This class generates a formatted dump of a PPIx::QuoteLike object, or a string that can be made into such an object.

METHODS
This class supports the following public methods. Methods not documented here are private, and unsupported in the sense that the author reserves the right to change or remove them without notice.

  new
 my $dumper = PPIx::QuoteLike::Dumper->new(
     '"foo$bar baz"',
     variables  => 1,
 );

This static method instantiates the dumper. It takes the string or PPIx::QuoteLike object to be dumped as the first argument. Optional further arguments may be passed as name/value pairs.

The following optional arguments are recognized:

encoding name
    This argument is the encoding of the object to be dumped. It is passed through to PPIx::QuoteLike new() unless the first argument was a PPIx::QuoteLike object, in which case it is ignored.

indent number
    This argument specifies the number of additional spaces to indent each level of the parse hierarchy. This is ignored if the "tokens" argument is true.

    The default is 2.

margin number
    This argument is the number of additional spaces to indent the parse hierarchy, over those specified by the margin.

    The default is 0.

perl_version Boolean
    This argument specifies whether or not the perl versions introduced and removed are included in the dump.

    The default is 0 (i.e. false).

postderef Boolean
    THIS ARGUMENT IS DEPRECATED. See DEPRECATION NOTICE in PPIx::QuoteLike for the details.

    This argument specifies whether or not postfix dereferences are recognized in interpolations. It is passed through to PPIx::QuoteLike new() unless the first argument was a PPIx::QuoteLike object, in which case it is ignored.

ppi Boolean
    This argument specifies whether or not a PPI dump is provided for interpolations.

    The default is 0 (i.e. false).

short Boolean
    If true, leading 'PPIx::QuoteLike::' will be removed from the class names in the output.

tokens boolean
    If true, this argument causes an unstructured dump of tokens found in the parse.

    The default is 0 (i.e. false).

variables Boolean
    If true, this argument causes all variables actually interpolated by any interpolations to be dumped.

    The default is 0 (i.e. false).

  dump
 print PPIx::Regexp::Dumper->dump( 'foo/bar.pl',
     variables => 1,
 );

This static method returns a string that represents a dump of its first argument. It takes the same optional arguments as new(). This method differs from new() in its interpretation of the first argument.

•   If the first argument is the name of a file, or is a SCALAR reference, it is made into a PPI::Document and all strings in the document are dumped.

•   If the first argument is a PPI::Node all strings in the node are dumped. Note that a PPI::Document is a PPI::Node.

Otherwise the first argument is handled just like new() would handle it.

The return is the string representation of the dump.

In addition to the optional arguments accepted by new(), the following can be specified:

none
    This argument specifies a string to return if no dump can be produced (typically because the first argument is neither a file name nor text that is recognized by this package). If unspecified, or specified as "undef", nothing is returned in this case.

The output for an individual quote-like object differs from the string() output on the same object in that it is preceded by the literal sting being dumped, and file and location information if that can be determined.

  list
 print map { "$_\n" } $dumper->list();

This method returns an array containing the dump output. one line per element. The output has no left margin applied, and no trailing newlines. Embedded newlines are probable if the "ppi" argument was specified when the dumper was instantiated.

  print
 $dumper->print();

This method simply prints the result of "string" to standard out.

  string
 print $dumper->string();

This method adds left margin and newlines to the output of "list", concatenates the result into a single string, and returns that string.

SUPPORT
Support is by the author. Please file bug reports at <https://github.com/trwyant/perl-PPIx-QuoteLike/issues> or in electronic mail to the author.

AUTHOR
Thomas R. Wyant, III harryfmudd at comcast dot net

COPYRIGHT AND LICENSE
Copyright (C) 2016-2022, 2026 by Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the files LICENSE-Artistic and LICENSE-GPL.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.