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