3 package Devel::REPL::Plugin::PPI;
4 use Devel::REPL::Plugin;
9 use namespace::autoclean;
13 $self->load_plugin('Turtles');
16 sub expr_command_ppi {
17 my ( $self, $eval, $code ) = @_;
19 my $document = PPI::Document->new(\$code);
20 my $dumper = PPI::Dumper->new($document);
21 return $dumper->string;
32 Devel::REPL::Plugin::PPI - PPI dumping of Perl code
36 repl> #ppi Devel::REPL
39 PPI::Token::Word 'Devel::REPL'
45 PPI::Statement::Compound
46 PPI::Structure::Block { ... }
47 PPI::Token::Whitespace '\n'
49 PPI::Token::Word 'warn'
50 PPI::Token::Whitespace ' '
51 PPI::Token::Magic '$]'
52 PPI::Token::Structure ';'
53 PPI::Token::Whitespace '\n'
57 This plugin provides a C<ppi> command that uses L<PPI::Dumper> to dump
58 L<PPI>-parsed Perl documents.
60 The code is not actually executed, which means that when used with
61 L<Deve::REPL::Plugin::OutputCache> there is no new value in C<_>.
65 Shawn M Moore E<lt>sartak@gmail.comE<gt>