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   3618 use strict;
  2         4  
  2         91  
2 2     2   14 use warnings;
  2         4  
  2         146  
3             package Devel::REPL::Plugin::PPI;
4             # ABSTRACT: PPI dumping of Perl code
5              
6             our $VERSION = '1.003027';
7              
8 2     2   12 use Devel::REPL::Plugin;
  2         5  
  2         17  
9 2     2   13391 use PPI;
  2         4  
  2         71  
10 2     2   1857 use PPI::Dumper;
  2         2934  
  2         97  
11 2     2   21 use namespace::autoclean;
  2         3  
  2         28  
12              
13             sub BEFORE_PLUGIN {
14 1     1 0 4 my $self = shift;
15 1         7 $self->load_plugin('Turtles');
16             }
17              
18             sub expr_command_ppi {
19 0     0 0   my ( $self, $eval, $code ) = @_;
20              
21 0           my $document = PPI::Document->new(\$code);
22 0           my $dumper = PPI::Dumper->new($document);
23 0           return $dumper->string;
24             }
25              
26             __PACKAGE__
27              
28             __END__
29              
30             =pod
31              
32             =encoding UTF-8
33              
34             =head1 NAME
35              
36             Devel::REPL::Plugin::PPI - PPI dumping of Perl code
37              
38             =head1 VERSION
39              
40             version 1.003027
41              
42             =head1 SYNOPSIS
43              
44             repl> #ppi Devel::REPL
45             PPI::Document
46             PPI::Statement
47             PPI::Token::Word 'Devel::REPL'
48              
49             repl> #ppi {
50             > warn $];
51             > }
52             PPI::Document
53             PPI::Statement::Compound
54             PPI::Structure::Block { ... }
55             PPI::Token::Whitespace '\n'
56             PPI::Statement
57             PPI::Token::Word 'warn'
58             PPI::Token::Whitespace ' '
59             PPI::Token::Magic '$]'
60             PPI::Token::Structure ';'
61             PPI::Token::Whitespace '\n'
62              
63             =head1 DESCRIPTION
64              
65             This plugin provides a C<ppi> command that uses L<PPI::Dumper> to dump
66             L<PPI>-parsed Perl documents.
67              
68             The code is not actually executed, which means that when used with
69             L<Deve::REPL::Plugin::OutputCache> there is no new value in C<_>.
70              
71             =head1 AUTHOR
72              
73             Shawn M Moore E<lt>sartak@gmail.comE<gt>
74              
75             =head1 COPYRIGHT AND LICENSE
76              
77             This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>).
78              
79             This is free software; you can redistribute it and/or modify it under
80             the same terms as the Perl 5 programming language system itself.
81              
82             =cut