File Coverage

blib/lib/Devel/REPL/Plugin/PPI.pm
Criterion Covered Total %
statement 20 24 83.3
branch n/a
condition n/a
subroutine 7 8 87.5
pod 0 2 0.0
total 27 34 79.4


line stmt bran cond sub pod time code
1 2     2   1990 use strict;
  2         7  
  2         73  
2 2     2   10 use warnings;
  2         4  
  2         95  
3             # ABSTRACT: PPI dumping of Perl code
4              
5             our $VERSION = '1.003029';
6              
7             use Devel::REPL::Plugin;
8 2     2   11 use PPI;
  2         4  
  2         12  
9 2     2   8115 use PPI::Dumper;
  2         6  
  2         46  
10 2     2   882 use namespace::autoclean;
  2         1771  
  2         58  
11 2     2   11  
  2         5  
  2         15  
12             my $self = shift;
13             $self->load_plugin('Turtles');
14 1     1 0 3 }
15 1         4  
16             my ( $self, $eval, $code ) = @_;
17              
18             my $document = PPI::Document->new(\$code);
19 0     0 0   my $dumper = PPI::Dumper->new($document);
20             return $dumper->string;
21 0           }
22 0            
23 0           __PACKAGE__
24              
25              
26             =pod
27              
28             =encoding UTF-8
29              
30             =head1 NAME
31              
32             Devel::REPL::Plugin::PPI - PPI dumping of Perl code
33              
34             =head1 VERSION
35              
36             version 1.003029
37              
38             =head1 SYNOPSIS
39              
40             repl> #ppi Devel::REPL
41             PPI::Document
42             PPI::Statement
43             PPI::Token::Word 'Devel::REPL'
44              
45             repl> #ppi {
46             > warn $];
47             > }
48             PPI::Document
49             PPI::Statement::Compound
50             PPI::Structure::Block { ... }
51             PPI::Token::Whitespace '\n'
52             PPI::Statement
53             PPI::Token::Word 'warn'
54             PPI::Token::Whitespace ' '
55             PPI::Token::Magic '$]'
56             PPI::Token::Structure ';'
57             PPI::Token::Whitespace '\n'
58              
59             =head1 DESCRIPTION
60              
61             This plugin provides a C<ppi> command that uses L<PPI::Dumper> to dump
62             L<PPI>-parsed Perl documents.
63              
64             The code is not actually executed, which means that when used with
65             L<Deve::REPL::Plugin::OutputCache> there is no new value in C<_>.
66              
67             =head1 SUPPORT
68              
69             Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL>
70             (or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>).
71              
72             There is also an irc channel available for users of this distribution, at
73             L<C<#devel> on C<irc.perl.org>|irc://irc.perl.org/#devel-repl>.
74              
75             =head1 AUTHOR
76              
77             Shawn M Moore E<lt>sartak@gmail.comE<gt>
78              
79             =head1 COPYRIGHT AND LICENCE
80              
81             This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>).
82              
83             This is free software; you can redistribute it and/or modify it under
84             the same terms as the Perl 5 programming language system itself.
85              
86             =cut