increment $VERSION after 1.003029 release
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Plugin / PPI.pm
CommitLineData
1716b200 1use strict;
2use warnings;
c5bf3ed2 3package Devel::REPL::Plugin::PPI;
9d2a4940 4# ABSTRACT: PPI dumping of Perl code
c5bf3ed2 5
77327851 6our $VERSION = '1.003030';
54beb05d 7
6f4f9516 8use Devel::REPL::Plugin;
c5bf3ed2 9use PPI;
10use PPI::Dumper;
aa8b7647 11use namespace::autoclean;
c5bf3ed2 12
3a400715 13sub BEFORE_PLUGIN {
14 my $self = shift;
15 $self->load_plugin('Turtles');
16}
c5bf3ed2 17
18sub expr_command_ppi {
19 my ( $self, $eval, $code ) = @_;
20
21 my $document = PPI::Document->new(\$code);
22 my $dumper = PPI::Dumper->new($document);
23 return $dumper->string;
24}
25
26__PACKAGE__
27
28__END__
29
30=pod
31
c5bf3ed2 32=head1 SYNOPSIS
33
34 repl> #ppi Devel::REPL
35 PPI::Document
36 PPI::Statement
37 PPI::Token::Word 'Devel::REPL'
afc8677b 38
c5bf3ed2 39 repl> #ppi {
40 > warn $];
41 > }
42 PPI::Document
43 PPI::Statement::Compound
44 PPI::Structure::Block { ... }
45 PPI::Token::Whitespace '\n'
46 PPI::Statement
47 PPI::Token::Word 'warn'
48 PPI::Token::Whitespace ' '
49 PPI::Token::Magic '$]'
50 PPI::Token::Structure ';'
51 PPI::Token::Whitespace '\n'
52
53=head1 DESCRIPTION
54
55This plugin provides a C<ppi> command that uses L<PPI::Dumper> to dump
56L<PPI>-parsed Perl documents.
57
58The code is not actually executed, which means that when used with
59L<Deve::REPL::Plugin::OutputCache> there is no new value in C<_>.
60
61=head1 AUTHOR
62
63Shawn M Moore E<lt>sartak@gmail.comE<gt>
64
65=cut