Commit | Line | Data |
1c4d0148 |
1 | #!/usr/bin/perl |
2 | |
3 | package Devel::REPL::Plugin::Peek; |
4 | use Devel::REPL::Plugin; |
5 | |
6 | use Devel::Peek qw(Dump); |
7 | |
8 | use namespace::clean -except => [ 'meta' ]; |
9 | |
10 | with qw(Devel::REPL::Plugin::Turtles); |
11 | |
12 | sub expr_command_peek { |
13 | my ( $self, $eval, $code ) = @_; |
14 | |
15 | if ( my $cont = $self->can("continue_reading_if_necessary") ) { |
16 | $code = $self->$cont($code); |
17 | } |
18 | |
19 | # can't override output properly |
20 | # FIXME do some dup wizardry |
21 | Dump( $self->eval($code) ); |
22 | |
23 | return ""; # this is a hack to print nothing after Dump has already printed. PLZ TO FIX KTHX! |
24 | } |
25 | |
26 | __PACKAGE__ |
27 | |
28 | __END__ |
29 | |
30 | =pod |
31 | |
32 | =head1 NAME |
33 | |
34 | Devel::REPL::Plugin::Peek - L<Devel::Peek> plugin for L<Devel::REPL>. |
35 | |
36 | =head1 SYNOPSIS |
37 | |
38 | repl> #peek "foo" |
39 | SV = PV(0xb3dba0) at 0xb4abc0 |
40 | REFCNT = 1 |
41 | FLAGS = (POK,READONLY,pPOK) |
42 | PV = 0x12bcf70 "foo"\0 |
43 | CUR = 3 |
44 | LEN = 4 |
45 | |
46 | =head1 DESCRIPTION |
47 | |
48 | This L<Devel::REPL::Plugin> adds a C<peek> command that calls |
49 | L<Devel::Peek/Dump> instead of the normal printing. |
50 | |
51 | =head1 SEE ALSO |
52 | |
53 | L<Devel::REPL>, L<Devel::Peek> |
54 | |
55 | =head1 AUTHOR |
56 | |
57 | Yuval Kogman E<lt>nothingmuch@woobling.orgE<gt> |
58 | |
59 | =cut |