#!/usr/bin/env perl use strict; use warnings; use PPI::Document; use PPI::Dumper; our $VERSION = '1.088'; my $whitespace = $ARGV[0] && $ARGV[0] eq '-w' ? shift : 0; my $code = $ARGV[0] ? (-f $ARGV[0] ? shift : \shift) : \join q{}, ; my $doc = PPI::Document->new( $code ) or die 'Could not parse code: ', PPI::Document::errstr(), "\n"; my $dump = PPI::Dumper->new( $doc, whitespace => $whitespace ); $dump->print(); __END__ #----------------------------------------------------------------------------- =pod =head1 NAME ppidump - Dump Perl code as PPI structure. =head1 SYNOPSIS ppidump #Read from STDIN ppidump MyModule.pm #Read code from file ppidump 'my $foo = $bar;' #Read code as from string ppidump -w 'foo( );' #Show whitespace tokens =head1 DESCRIPTION This is a simple tool for helping to develop Perl::Critic::Policy modules. If you want to see how L would parse a snippet of code, just feed it to C. By default, whitespace tokens are hidden. Use the C<-w> flag to show them. =head1 AUTHOR Jeffrey Ryan Thalhammer =head1 COPYRIGHT Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. =cut ############################################################################## # Local Variables: # mode: cperl # cperl-indent-level: 4 # fill-column: 78 # indent-tabs-mode: nil # c-indentation-style: bsd # End: # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :