#!/usr/bin/env perl

use 5.006;

use strict;
use warnings;

use Getopt::Long 2.33 qw{ :config auto_version };
use Pod::Usage;
use PPIx::QuoteLike::Dumper;

our $VERSION = '0.004';

my %opt;

GetOptions( \%opt,
    qw{ encoding=s perl_version|perl-version! ppi! tokens! variables! },
    help => sub { pod2usage( { -verbose => 2 } ) },
) or pod2usage( { -verbose => 0 } );

defined $opt{encoding}
    and binmode STDOUT, ":encoding($opt{encoding})";

my @dumper_arg = map { $_ => $opt{$_} }
    qw{ perl_version ppi tokens variables };

foreach my $arg ( @ARGV ) {
    print PPIx::QuoteLike::Dumper->dump( $arg, @dumper_arg );
}

__END__

=head1 TITLE

pqldump - Dump a quotelike thing

=head1 SYNOPSIS

 pqldump '"foo$bar"'
 pqldump fubar.pl
 pqldump -help
 pqldump -version

=head1 OPTIONS


=head2 -encoding

 -encoding utf-8

This option specifies the encoding of the entities to be parsed, and of
the output. If unspecified, no encoding is assumed unless the input is a
file, in which case the file's encoding is derived from its PPI parse.

=head2 -help

This option displays the documentation for this script. The script then
exits.

=head2 -perl-version

If asserted, this option causes the minimum Perl version (and the
maximum if applicable) to be dumped.

The defualt is C<-noperl-version>.

=head2 -ppi

If asserted, this option causes a PPI dump on any interpolations found.
L<PPI|PPI> must be installed for this to work.

The default is C<-noppi>.

=head2 -tokens

If asserted, an unstructured dump of the tokens found is done.

The default is C<-notokens>.

=head2 -variables

If asserted, this option causes the names of variables interpolated by
any interpolations found to be dumped. L<PPI|PPI> must be installed for
this to work.

The default is C<-novariables>.

=head2 -version

This option displays the version of this script. The script then exits.

=head1 DETAILS

<<< replace boiler plate >>>

=head1 AUTHOR

Thomas R. Wyant, III F<wyant at cpan dot org>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2016 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 directory LICENSES.

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.

=cut

# ex: set textwidth=72 :
