App-PPI-Dumper
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/App/PPI/Dumper.pm view on Meta::CPAN
Do not show the full package name for each PPI class.
=item -T
Do not show the original source token that goes with each PPI object.
=item -W
Do not show whitespace tokens.
=item -C
Do not show comment tokens.
=item -l
Show the source code location of each PPI token.
=item -r
Parse the input in readonly mode. See PPI::Document::new() for the details.
=back
=back
=head1 SEE ALSO
Most behaviour, including environment variables and configuration,
comes directly from PPI::Dumper. I just made a command-line tool for it.
=head1 SOURCE AVAILABILITY
This code is in Github:
https://github.com/briandfoy/app-ppi-dumper.git
=head1 AUTHOR
brian d foy, C<< <briandfoy@pobox.com> >>
=head1 COPYRIGHT
Copyright © 2009-2024, brian d foy <briandfoy@pobox.com>. All rights reserved.
You may redistribute this under the terms of the Artistic License 2.0.
=cut
use Getopt::Std qw(getopts);
use PPI;
use PPI::Dumper;
__PACKAGE__->run(@ARGV) unless caller;
# same defaults as PPI::Dumper
sub run {
my $self = shift;
local @ARGV = @_;
my %opts = (
'm' => 0, # memaddr
'i' => 2, # indent
'P' => 0, # class
'D' => 0, # content
'W' => 0, # whitespace
'C' => 0, # comments
'l' => 0, # locations
'r' => 0, # read-only, for PPI::Document
);
getopts('mPDWCli:', \%opts);
my $Module = PPI::Document->new(
$ARGV[0],
readonly => $opts{'r'},
);
die "Could not parse [$ARGV[0]] for PPI: " . PPI::Document->errstr . "\n"
if PPI::Document->errstr;
my $Dumper = PPI::Dumper->new( $Module,
memaddr => $opts{'m'},
indent => $opts{'i'},
class => ! $opts{'P'},
content => ! $opts{'D'},
whitespace => ! $opts{'W'},
comments => ! $opts{'C'},
locations => $opts{'l'},
);
$Dumper->print;
}
1;
__END__
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.704 second using v1.00-cache-2.02-grep-82fe00e-cpan-9e6bc14194b )